LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default Omit header from first page without embedding header in code

I want to print a multi-page worksheet omitting the header on the first page.
However, I also want to create a macro to do this without embedding the
header info in the code. I do not know VBA programming, but I have been
reading some web sites and playing around with it.

Here's a solution that I thought would work (maybe it just needs some
tweaking):

Sub NoFirstPageHeader_AllSheets()
Dim wsSheet As Worksheet
Dim sHeader As String
For Each wsSheet In Worksheets
With wsSheet
sHeader = .PageSetup.LeftHeader
.PageSetup.LeftHeader = ""
sHeader = .PageSetup.CenterHeader
.PageSetup.CenterHeader = ""
sHeader = .PageSetup.RightHeader
.PageSetup.RightHeader = ""
.PrintOut From:=1, To:=1
sHeader = .PageSetup.LeftHeader
sHeader = .CenterHeader
sHeader = .RightHeader
.PrintOut From:=2
End With
Next wsSheet
End Sub

The problem is that this code deletes my header entirely instead of what I
intended it to do (omit the header on the first page). I tried to replace
"PageSetup" with "Print" but that, of course, did not work. I am surprised
that doing a simple thing like omitting the header on the first page is such
a big deal.

I have come up with a few workarounds, but if anyone knows of a macro that
can do what I described, please let me know. Again, the sticky part is that I
want this to work in any workbook with different page headers.

Thanks!
 
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
Does anyone know the code to put a number in the right header... Jennifer-Houston, TX[_2_] Excel Discussion (Misc queries) 3 August 20th 07 03:22 PM
Does anyone know the code to put a number in the right header and. Jennifer-Houston, TX[_2_] Excel Discussion (Misc queries) 4 August 17th 07 02:12 AM
Does anyone know the code to put a number in the right header... Gary''s Student Excel Discussion (Misc queries) 2 August 17th 07 01:54 AM
VBA Code to Add the same header from my first sheet into 20 sheets [email protected] Excel Worksheet Functions 4 December 15th 06 02:13 AM
Excel-Header-My Company Name won't work in Header (AT&T) & Time June K Excel Discussion (Misc queries) 2 April 10th 06 08:36 PM


All times are GMT +1. The time now is 02:05 AM.

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"