Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default Suppress First Page Header

I'm working in Excel 2002.

I would like to have a header appear on the second page and the pages that
follow.
The text that I want printed in the header beginning on page 2 is Unit
Intake Report (continued).

I have tried using the following coding with no success:

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
End Sub

My document is protected. I've used the above coding sandwiched between:
ActiveSheet.Unprotect
ActiveSheet.Protect

This still does not produce a header. Can I suppress the first page header
within a protected document?

Thanks
--
Jamie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Suppress First Page Header

Jamie,

I just ran your exact code on a protected sheet with two pages.
Ran and printed without a problem - with header printed on
the second page only. (XL2002)

Regards,
Jim Cone
San Francisco, USA


"Jamie" wrote in message
...
I'm working in Excel 2002.
I would like to have a header appear on the second page and the pages that
follow.
The text that I want printed in the header beginning on page 2 is Unit
Intake Report (continued).
I have tried using the following coding with no success:
Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
End Sub
My document is protected. I've used the above coding sandwiched between:
ActiveSheet.Unprotect
ActiveSheet.Protect
This still does not produce a header. Can I suppress the first page header
within a protected document?
Thanks
Jamie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default Suppress First Page Header

Hi Jim to print the document I was using the print button. One of my
coworkers pointed out that I needed to print from within the macro itself
clicking on the Run Sub/User Form. Doing that the document prints out great.
Thanks for your help, I appreciate it.
--
Jamie


"Jim Cone" wrote:

Jamie,

I just ran your exact code on a protected sheet with two pages.
Ran and printed without a problem - with header printed on
the second page only. (XL2002)

Regards,
Jim Cone
San Francisco, USA


"Jamie" wrote in message
...
I'm working in Excel 2002.
I would like to have a header appear on the second page and the pages that
follow.
The text that I want printed in the header beginning on page 2 is Unit
Intake Report (continued).
I have tried using the following coding with no success:
Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
End Sub
My document is protected. I've used the above coding sandwiched between:
ActiveSheet.Unprotect
ActiveSheet.Protect
This still does not produce a header. Can I suppress the first page header
within a protected document?
Thanks
Jamie


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Suppress First Page Header

Jamie,
You are welcome.
A way to start the macro from the worksheet is to
go to the menu bar...

Tools | Macro | Macros...

In the displayed list of macros,
select your macro and click the "Run" button.

Regards,
Jim Cone
San Francisco, USA


"Jamie" wrote in message
...
Hi Jim to print the document I was using the print button. One of my
coworkers pointed out that I needed to print from within the macro itself
clicking on the Run Sub/User Form. Doing that the document prints out great.
Thanks for your help, I appreciate it.
Jamie



"Jim Cone" wrote:
Jamie,
I just ran your exact code on a protected sheet with two pages.
Ran and printed without a problem - with header printed on
the second page only. (XL2002)
Regards,
Jim Cone
San Francisco, USA




"Jamie" wrote in message
...
I'm working in Excel 2002.
I would like to have a header appear on the second page and the pages that
follow.
The text that I want printed in the header beginning on page 2 is Unit
Intake Report (continued).
I have tried using the following coding with no success:
Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
End Sub
My document is protected. I've used the above coding sandwiched between:
ActiveSheet.Unprotect
ActiveSheet.Protect
This still does not produce a header. Can I suppress the first page header
within a protected document?
Thanks
Jamie


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default Suppress First Page Header

Hi Jim, thanks for your help. I have another question. Can I add coding
to the macro so the user can either use the print button or File, Print.
I'd like to keep them out of Tools, Macro, Macros. Also I'd like to stay
away from creating a print button on the worksheet.

--
Jamie


"Jim Cone" wrote:

Jamie,
You are welcome.
A way to start the macro from the worksheet is to
go to the menu bar...

Tools | Macro | Macros...

In the displayed list of macros,
select your macro and click the "Run" button.

Regards,
Jim Cone
San Francisco, USA


"Jamie" wrote in message
...
Hi Jim to print the document I was using the print button. One of my
coworkers pointed out that I needed to print from within the macro itself
clicking on the Run Sub/User Form. Doing that the document prints out great.
Thanks for your help, I appreciate it.
Jamie



"Jim Cone" wrote:
Jamie,
I just ran your exact code on a protected sheet with two pages.
Ran and printed without a problem - with header printed on
the second page only. (XL2002)
Regards,
Jim Cone
San Francisco, USA




"Jamie" wrote in message
...
I'm working in Excel 2002.
I would like to have a header appear on the second page and the pages that
follow.
The text that I want printed in the header beginning on page 2 is Unit
Intake Report (continued).
I have tried using the following coding with no success:
Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
End Sub
My document is protected. I've used the above coding sandwiched between:
ActiveSheet.Unprotect
ActiveSheet.Protect
This still does not produce a header. Can I suppress the first page header
within a protected document?
Thanks
Jamie




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Suppress First Page Header

Jamie,

You can use the "BeforePrint" event that Excel provides.
If you do this every sheet in the workbook will use your
code when it is printed...
Jim Cone
San Francisco, USA


In the ThisWorkbook module add the following code:
'------------------------------
Option Explicit

Private Sub Workbook_BeforePrint(Cancel As Boolean)
'Prevent normal printing.
Cancel = True
'Call the macro with printing code.
PrintTest
End Sub
'------------------------------
'------------------------------

In a standard module add the following code...
(your code with some additional lines)
'-------------------------------------
Option Explicit

Sub PrintTest()
On Error GoTo PrintError ' New line
Application.EnableEvents = False ' New line
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
With ActiveSheet.PageSetup
.LeftHeader = ""
ActiveSheet.PrintOut From:=1, To:=1
.LeftHeader = "Unit Intake Report (continued)"
ActiveSheet.PrintOut From:=2, To:=TotPages
End With
PrintError: ' New line
Application.EnableEvents = True ' New line
End Sub
'------------------------------------
'------------------------------------


"Jamie" wrote in message
...
Hi Jim, thanks for your help. I have another question. Can I add coding
to the macro so the user can either use the print button or File, Print.
I'd like to keep them out of Tools, Macro, Macros. Also I'd like to stay
away from creating a print button on the worksheet.
Jamie




"Jim Cone" wrote:
Jamie,
You are welcome.
A way to start the macro from the worksheet is to
go to the menu bar...
Tools | Macro | Macros...
In the displayed list of macros,
select your macro and click the "Run" button.
Regards,
Jim Cone
San Francisco, USA


-snip-
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
Suppress First Page Numbering Michael Excel Worksheet Functions 4 April 27th 10 08:43 PM
How do I suppress the Header/Footer? Angelhearts Excel Discussion (Misc queries) 4 November 17th 09 05:54 PM
How do you suppress the page number on page one? SUPPRESSING PAGE NUMBERS IN EXCEL Excel Discussion (Misc queries) 4 May 13th 09 01:19 PM
How do I suppress a header of footer on the first page of a docume SLF Setting up and Configuration of Excel 0 January 24th 06 06:10 PM
Suppress First Page Header Jamie Excel Worksheet Functions 7 May 13th 05 05:48 PM


All times are GMT +1. The time now is 10:22 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"