Disclaimer: It\'s been a few years since I worked (a lot) with VBA, so this might be an issue caused by confusing myself with what is essentially a very different language f
The line Application.PrintCommunication = False (which is added by the macro recorder) before doing PageSetup screws up the formating via VBA.
Application.PrintCommunication = False
If your code has got this line in it, try removing it. That solved my problem with setting the header and footer via VBA.