Custom footer will not print from Macro

sbuca76

New Member
Joined
Mar 22, 2011
Messages
2
I have recorded a macro in Excel 2010 which contains, as part of it, inserting a custom footer, specifically the file name. When the macro is run, the filename disappears even though the macro code shows the center footer containing the code "&F". Is this a bug or is there an update for it?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I was having the same problem. I found this workaround on Microsoft's site

In place of your VBA code that gets recorded, in the appropriate footer or header section do the following (hit ALT+F11 to get to the VBA editor and open the Module on the left side that was created):
To show the current page number replace &P with &P[]
To show the number of pages in your workbook, replace &P with &N[]
To show the current date, replace &D with &D[]
To show the current time replace &T with &T[]
To show the file path replace &P or whatever got recorded with &Z[]
To insert the current file name replace &F with &F[]
To insert the sheet name replace &Tab with &A[]
 
Upvote 0
I just found a better way to make this work. PrintCommunication is new to 2010 (maybe 2007 too, I don't know) and it will come up in your macro, especially if you use the recorder.

Remove all Application.PrintCommunication, it can be true or false, from your macro.

Headers and Footers should work fine!

The macros do work a little slower, but it seems ok
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,767
Members
449,049
Latest member
greyangel23

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