I have a problem, very similar to this one and that answer really doesn't help me..
To be specific, I'm trying to create a macro in an xlam file. The macro should insert images stored in the xlam file into the active excel file in the header and footer.
This little piece of code works as long as it's referencing a full path filename, but if I copy the xlam file to a different computer, the image files cannot be found (since obviously the files are not located there).
So how do I reference the images stored in the xlam file in a macro like this one?
I need to exchange the Filenames with something relative or something embedded in the xlam.
Sub LogoAdd(ByVal control As IRibbonControl)
Sheets(1).Activate
With ActiveSheet.PageSetup
.DifferentFirstPageHeaderFooter = True
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.FirstPage.RightHeader.Text = "&G"
.FirstPage.RightFooter.Text = "&G"
End With
ActiveSheet.PageSetup.FirstPage.RightHeader.Picture.Filename = _
"C:\***filenameandpathremoved***.jpg"
ActiveSheet.PageSetup.FirstPage.RightFooter.Picture.Filename = _
"C:\***filenameandpathremoved***.png"
End Sub
Bookmarks