Which version of Excel, and what is actually happening?
Hi,
I want to take a .jpg picture from my computer and insert it in the left and another one in the richt corner of the header. In my opinion this program should work but it won't and I don't know why.
Here is my code I have until now:
Thank you for your helpCode:With ActiveSheet.PageSetup.LeftHeaderPicture .Filename = "D:\Eigene Dateien\Customer Logo.jpg" End With With ActiveSheet.PageSetup.RightHeaderPicture .Filename = "D:\Eigene Dateien\picutre2.jpg" End With 'Insert of the Header and Footer including pictures With ws.PageSetup .LeftHeader = "&G" .CenterHeader = "Electrical Load Analysis" .RightHeader = "&G" .CenterFooter = "&A" .RightFooter = Format(Date, "dd.mm.yyyy") End With
Which version of Excel, and what is actually happening?
First thing I see is that the first two With constructs refer to the ActiveSheet, while the third refers to ws. Those may not be the same worksheets.
I'd write it as follows:
Curious though... what is the "&G" for?Code:With ws.PageSetup .LeftHeaderPicture.Filename = "D:\Eigene Dateien\Customer Logo.jpg" .RightHeaderPicture.Filename = "D:\Eigene Dateien\picutre2.jpg" .LeftHeader = "&G" .CenterHeader = "Electrical Load Analysis" .RightHeader = "&G" .CenterFooter = "&A" .RightFooter = Format(Date, "dd.mm.yyyy") End With
Ken Puls, FCPA, FCMA, MS MVP
Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!
Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter
If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.
If using 2010, do not turn off printcommunication
The &G is needed to actually show the picture.
Ken Puls, FCPA, FCMA, MS MVP
Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!
Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter
If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.
Bookmarks