Re: Suppress First Page Header
- From: "Jamie" <Jamie@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 13 May 2005 11:00:02 -0700
Hi Jim, me again. Thanks so much for your time I really appreciate it. I
inserted the coding you provided. I'm getting an error message in This
Workbook. The error is: Compile error: Sub or Function not defined.
The code that is highlighted is PrintTest. I've checked the coding and it
matches yours.
I wasn't sure if I was to include Option Explicit so I entered it, but with
or without it I still receive the message. Do I need to include Option
Explicit?
Thanks so much!
--
Jamie
"Jim Cone" wrote:
> Jamie,
>
> You can use the "BeforePrint" event that Excel provides.
> If you do this every *** 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 Active***.PageSetup
> .LeftHeader = ""
> Active***.PrintOut From:=1, To:=1
> .LeftHeader = "Unit Intake Report (continued)"
> Active***.PrintOut From:=2, To:=TotPages
> End With
> PrintError: ' New line
> Application.EnableEvents = True ' New line
> End Sub
> '------------------------------------
> '------------------------------------
>
>
> "Jamie" <Jamie@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:AB93B194-919C-4BDC-8CA9-3649589A19A3@xxxxxxxxxxxxxxxx
> > 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 work***.
> > Jamie
>
>
>
> > "Jim Cone" wrote:
> > > Jamie,
> > > You are welcome.
> > > A way to start the macro from the work*** 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-
>
.
- Follow-Ups:
- Re: Suppress First Page Header
- From: Jim Cone
- Re: Suppress First Page Header
- References:
- Suppress First Page Header
- From: Jamie
- Re: Suppress First Page Header
- From: Jim Cone
- Re: Suppress First Page Header
- From: Jamie
- Re: Suppress First Page Header
- From: Jim Cone
- Re: Suppress First Page Header
- From: Jamie
- Re: Suppress First Page Header
- From: Jim Cone
- Suppress First Page Header
- Prev by Date: Re: optional argument in a function
- Next by Date: Strike out feature
- Previous by thread: Re: Suppress First Page Header
- Next by thread: Re: Suppress First Page Header
- Index(es):