We work with a lot of workbooks with multiple tabs that contain dated information, tab name, etc. in the header/footer and I want to create a way to automate the updating of the header/footers of these workbooks every year. I'm having a problem adding a picture to the footer, the rest of the code seems to work fine. Here is the code:
I keep receiving the "Run-time error '1004': Application-defined or object-defined error" message once I run this code. I have tried with and without the "&G" declaration while receiving the same error.
Any suggestions are greatly appreciate, thank you!
Code:
Sub header_footer_unscale_new()Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws.PageSetup
.ScaleWithDocHeaderFooter = False
.TopMargin = Application.InchesToPoints(0.9)
.LeftHeader = "&B&""Arial Narrow""&08&K04+000Company Name" & vbCr & "Program Name" & vbCr & "Effective Date"
.RightHeader = ActiveSheet.Name
'.RightFooterPicture = "&G" 'specifies that you want an image in your footer
.RightFooterPicture.Filename = "H:\Templates\Excel Logo.jpg" 'specifies the image file
End With
ActiveWindow.View = xlNormalView
Range("A1").Activate
Next
End Sub
I keep receiving the "Run-time error '1004': Application-defined or object-defined error" message once I run this code. I have tried with and without the "&G" declaration while receiving the same error.
Any suggestions are greatly appreciate, thank you!
Last edited: