I tried both and have the error code:
Run time error 1004
Application defined or object define error
Note: The code is in a sheet named "Marks" : I have a button to press to run
the code
See the full code please:
Sub printcert()
Dim cell As Variant
For Each cell In Range("certprint")
If cell.Value = 1 Then
Sheets("Cer_2_M").Range("a3").Value = cell.Offset(0, -90)
Sheets("Cer_2_M").Select
' (ThisWorkbook.Path & "\logo_r.tif")
With ActiveSheet.PageSetup
.CenterHeader = "&G"
'.CenterHeaderPicture.Filename =
"D:\Rosary\School_System\ROS_Logo.tif"
'.CenterHeaderPicture.Filename = .Parent.Parent.Path &
"\ROS_logo.tif"
.CenterHeaderPicture.Filename = ActiveSheet.Parent.Path &
"\ROS_logo.tif"
.LeftHeader = "&""Arial,Bold""&11Rosary Sisters" & Chr(10) &
"&""Times New Roman,Bold""&11 Paul VI St."
.RightHeader = "&""PT Bold Heading""&12ãÏÑÓÉ ÑÇåÈÇÊ ÇáæÑÏíÉ" &
Chr(10) & "&""Traditional Arabic,Bold""&14 Ô. ÈæáÓ ÇáÓÇÏÓ"
.LeftFooter = "&""small fonts,Regular""&5Designed by Khalil Handal"
End With
' ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWindow.SelectedSheets.PrintPreview
End If
Next
End Sub
> And since you're using:
>
[quoted text clipped - 34 lines]
>>
>> Dave Peterson
Dave Peterson - 24 Jun 2007 19:03 GMT
It looks to me that the code belongs in a General module--not behind the sheet
named Marks (or any sheet).
And it looks like the .centerheaderpicture lines are commented out. So I don't
see how they could be causing the error.
What line causes the error?
> I tried both and have the error code:
> Run time error 1004
[quoted text clipped - 74 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Khalil Handal - 24 Jun 2007 19:41 GMT
Yes, the code belongs to a general module. What effect this will cause?The
button to click is in the sheet named "Marks"
I tried the following 2 lines of code one at a time and had the error:
.CenterHeaderPicture.Filename = .Parent.Parent.Path & "\ROS_logo.tif"
.CenterHeaderPicture.Filename = ActiveSheet.Parent.Path & "\ROS_logo.tif"
> It looks to me that the code belongs in a General module--not behind the
> sheet
[quoted text clipped - 92 lines]
>> >
>> > Dave Peterson
Dave Peterson - 24 Jun 2007 22:23 GMT
I'd check that folder and see if there really is a file by that name. I'm
guessing that you mistyped its name.
> Yes, the code belongs to a general module. What effect this will cause?The
> button to click is in the sheet named "Marks"
[quoted text clipped - 103 lines]
> >
> > Dave Peterson

Signature
Dave Peterson