View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jean-Paul Viel Jean-Paul Viel is offline
external usenet poster
 
Posts: 39
Default Changing Page Headers with Variables

Hi,

Add this code to the module ThisWorkbook:



Private Sub Workbook_BeforePrint(Cancel As Boolean)

ActiveSheet.PageSetup.RightHeader = "Traffic Data from " &
CStr(StartDate) & " to " & CStr(StopDate)

End Sub




--
JP

http://www.solutionsvba.com


"Ralph" wrote in message
...
Can anyone help me.

I have a an excel file with formulas saved as a
template. When I open the file I need to automatically
add the StartDate and StopDate to the Page Header.

The End-User enters 2 dates that are saved as variables.
The start date (StartDate), and the end date (StopDate).
these dates are entered in the following format xx/yy/zzzz.

I want to add this to the Top Right side of the Printed
page. Since the dates change everytime I figured I could
use the variables. However I do Not know how to
accomplish this.

What I want to appear on the Top Right of the page is:

Traffic Data from 09/01/2003 to 09-10/2003

Any and all help will be greatly appreciated.