Hello All!
First time posting since I have a string of code that doesn't seem to work and I can't find the reason why.
The code is used to add and format a picture to the footer of all sheets within a workbook. The code is as follows:
However when I enter this code only the document name and page numbering is placed correctly the picture does not show up. The picture is only needed when printing the file.
I hope one of you guys could maybe help me on my way.
Kind Regards,
Grompey
First time posting since I have a string of code that doesn't seem to work and I can't find the reason why.
The code is used to add and format a picture to the footer of all sheets within a workbook. The code is as follows:
VBA Code:
Private Sub Workbook_Open()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Sheets
With sh.PageSetup
.DifferentFirstPageHeaderFooter = False
.LeftFooterPicture.Filename = "C:\***.jpg"
With .LeftFooterPicture
.Height = 19.5
.Width = 54
End With
'.LeftHeader = ("")
'.CenterHeader = ("")
'.RightHeader = ("")
'.LeftFooter = ("")
.CenterFooter = ("&""Tahoma""&10[[[docname]]]")
.RightFooter = ("&""Tahoma""&10Page &P of &N ")
.LeftMargin = Application.CentimetersToPoints(1.5)
.RightMargin = Application.CentimetersToPoints(0.5)
.TopMargin = Application.CentimetersToPoints(1.2)
.BottomMargin = Application.CentimetersToPoints(1.6)
.HeaderMargin = Application.CentimetersToPoints(0.4)
.FooterMargin = Application.CentimetersToPoints(0.8)
End With
Next sh
End Sub
However when I enter this code only the document name and page numbering is placed correctly the picture does not show up. The picture is only needed when printing the file.
I hope one of you guys could maybe help me on my way.
Kind Regards,
Grompey
Last edited by a moderator: