copy footer from one file to another

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
2,004
Office Version
  1. 365
Platform
  1. Windows
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?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
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
 
Upvote 0
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
thanks nemmi. doesn't work. i think its because the footer is a picture.
 
Upvote 0
Hi ajm,

maybe use the code from How to extract picture from sheet headers?:

VBA Code:
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
This should show the full name of the picture in the immediate window and may lead to a code like
VBA Code:
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
Ciao,
Holger
 
Upvote 0

Forum statistics

Threads
1,213,564
Messages
6,114,334
Members
448,567
Latest member
Kuldeep90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top