Suppress First Page Header
Jim, thank you , thank you, thank you. It is working. I appreciate you
being so patient with me and continuing to answer my questions.
Many thanks!
--
Jamie
"Jim Cone" wrote:
Jamie,
Further,
The PrintTest code should "not" be in the sheet module.
If it is in the sheet module you will get that error.
In the VBE, you can go to the menu bar and click
"Insert | Module" to get a standard module added to the project.
And while Option Explicit is not required, it is good practice to
include it. It will notify you of typos and force you to declare
all variables..."Dim lngNumber as Long" etc.
Regards,
Jim Cone
"Jim Cone" wrote in message ...
Jamie,
The macro in the general module should be called "PrintTest",
not the old name of "Test" ???
Jim Cone
"Jamie" wrote in message
...
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 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
'------------------------------------
'------------------------------------
|