Results 1 to 3 of 3

Thread: Page numbering

  1. #1
    2 Star Lounger
    Join Date
    Jun 2008
    Location
    Watford UK
    Posts
    104
    Thanks
    1
    Thanked 1 Time in 1 Post
    I have been trying to acheive the following:

    1st page of document is a cover and has no page numbering (NOT zero)
    2nd page of document is a contents page and has no page numbering (NOT zero)
    3rd page of document is the first 'reading' page and is therefore page 1 and so on.

    The document is all on one sheet of a workbook.


    David

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi David,

    Try this code in the ThisWorkbook module:

    Code:
    Option Explicit
    Dim mbDisAbleEvent As Boolean
    
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    	Dim oSh As Worksheet
    	If mbDisAbleEvent Then Exit Sub
    	If ActiveSheet.Name <> "Sheet1" Then Exit Sub
    	Set oSh = ActiveSheet
    	Cancel = True
    	mbDisAbleEvent = True
    	With oSh
    		.PageSetup.LeftFooter = ""
    		.PrintOut 1, 1, , True
    		.PageSetup.LeftFooter = ""
    		.PrintOut 2, 2, , True
    		.PageSetup.LeftFooter = "&P of &N"
    		.PageSetup.FirstPageNumber = 1
    		.PrintOut 3, 100, , True
    	
    	End With
    	mbDisAbleEvent = False
    End Sub
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts
    NB: To do the actual printing, remove the last ", True" from the printout commands.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •