Thread: Footer Picture
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Richard Richard is offline
external usenet poster
 
Posts: 709
Default Footer Picture

How do I copy the footer/header picture from one worksheet to another?

The following code will put the existing picture into the Graph object but
when I try to set the Graph object of the new workbook I get an error...

Sub CopyFooterPicture()
On Error GoTo Trap
Dim wkOld As Worksheet, wkNew As Worksheet
Dim gphOld As Graphic, gphNew As Graphic

' get existing picture
Set wkOld = ThisWorkbook.Sheets("sheet1")
Set gphOld = wkOld.PageSetup.CenterFooterPicture

' new worksheet and picture
Set wkNew = ThisWorkbook.Worksheets.Add
' display the footer
wkNew.PageSetup.CenterFooter = "&G"
' get the new picture
Set gphNew = wkNew.PageSetup.CenterFooterPicture
' this bombs, since the Old filename is just the filename of the original
picture file w/o the extension
gphNew.Filename = gphOld.Filename

Exit Sub
Trap:
Debug.Print Err.Number & ": " & Err.Description
End Sub

Thanks,

--
Richard