• Page numbering

    • This topic has 2 replies, 2 voices, and was last updated 16 years ago.
    Author
    Topic
    #459094

    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

    Viewing 1 reply thread
    Author
    Replies
    • #1156509

      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
    • #1156510

      NB: To do the actual printing, remove the last “, True” from the printout commands.

    Viewing 1 reply thread
    Reply To: Page numbering

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: