Inserting a picture in the right and another in the left side of the header

AndreasL

New member
Joined
Oct 12, 2011
Messages
4
Reaction score
0
Points
0
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:
Code:
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

Thank you for your help
 
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:
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

Curious though... what is the "&G" for?
 
If using 2010, do not turn off printcommunication
 
The &G is needed to actually show the picture.
 
Back
Top