hi all, i want to copy the footer from one file to another. the footer is a picture and is in the footer section as &[Picture] in file 1. i didn't set up the file so don't have the source image. is it possible?
Sub TryTest()
With Sheets("Sheet2").PageSetup
.LeftHeader = Sheets("Sheet1").PageSetup.LeftHeader
.CenterHeader = Sheets("Sheet1").PageSetup.CenterHeader
.RightHeader = Sheets("Sheet1").PageSetup.RightHeader
.LeftFooter = Sheets("Sheet1").PageSetup.LeftFooter
.CenterFooter = Sheets("Sheet1").PageSetup.CenterFooter
.RightFooter = Sheets("Sheet1").PageSetup.RightFooter
End With
End Sub
thanks nemmi. doesn't work. i think its because the footer is a picture.Any use?
VBA Code:Sub TryTest() With Sheets("Sheet2").PageSetup .LeftHeader = Sheets("Sheet1").PageSetup.LeftHeader .CenterHeader = Sheets("Sheet1").PageSetup.CenterHeader .RightHeader = Sheets("Sheet1").PageSetup.RightHeader .LeftFooter = Sheets("Sheet1").PageSetup.LeftFooter .CenterFooter = Sheets("Sheet1").PageSetup.CenterFooter .RightFooter = Sheets("Sheet1").PageSetup.RightFooter End With End Sub
Sub test()
'John_w, Apr 26, 2009
'https://www.mrexcel.com/board/threads/how-to-extract-picture-from-sheet-headers.386395/
Dim pic As Graphic
Set pic = ActiveSheet.PageSetup.LeftFooterPicture 'alter to fit
Debug.Print pic.Filename
End Sub
Sub test2()
'John_w, Apr 26, 2009
'https://www.mrexcel.com/board/threads/how-to-extract-picture-from-sheet-headers.386395/
'mod 2022-08-09 for https://www.mrexcel.com/board/threads/copy-footer-from-one-file-to-another.1213001/
Dim pic As Graphic
Set pic = ActiveSheet.PageSetup.RightFooterPicture 'alter to fit
Debug.Print pic.Filename
Workbooks.Add
ActiveSheet.PageSetup.RightFooterPicture.Filename = pic.Filename
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = "&G"
End With
End Sub