Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Changing Page Headers with Variables

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Changing Page Headers with Variables

JP,

THanks that added the Text I wanted however it over-
wrote the Font command.

The Font was originally set for 12 Bold, now it comes
up the default 10 Regular.

Any Ideas.

Thanks again for your assistance.

-----Original Message-----
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.



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing all Dates on Headers Matt Dollar Excel Worksheet Functions 4 August 22nd 07 03:08 PM
Changing headers without macros or VB Stuart Mantel Excel Discussion (Misc queries) 2 February 21st 07 03:35 PM
Printing Headers on only first page and Footers on only last page JacMar Excel Discussion (Misc queries) 5 January 21st 07 03:48 PM
CHANGING THE COLUMN HEADERS FROM ABC.. TO 123.. ANNE V Excel Discussion (Misc queries) 4 September 16th 05 08:30 AM
Changing objects on other Worksheets with Variables Dave Baranas Excel Programming 3 August 10th 03 07:29 PM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"