NewDocument Method

Microsoft Publisher Visual Basic

expression.NewDocument(Wizard, Design)

expression    Required. An expression that returns one of the objects in the Applies To list.

Wizard   Optional PbWizard. The wizard to use to create the new publication.

PbWizard can be one of these PbWizard constants.
pbWizardAdvertisements
pbWizardAirplanes
pbWizardBanners
pbWizardBrochures
pbWizardBusinessCards
pbWizardBusinessForms
pbWizardCalendars
pbWizardCatalogs
pbWizardCertificates
pbWizardEnvelopes
pbWizardFlyers
pbWizardGiftCertificates
pbWizardGreetingCards
pbWizardInvitations
pbWizardJapaneseAdvertisements
pbWizardJapaneseAirplanes
pbWizardJapaneseBanners
pbWizardJapaneseBrochures
pbWizardJapaneseBusinessCards
pbWizardJapaneseBusinessForms
pbWizardJapaneseCalendars
pbWizardJapaneseCatalogs
pbWizardJapaneseCertificates
pbWizardJapaneseEnvelopes
pbWizardJapaneseFlyers
pbWizardJapaneseGiftCertificates
pbWizardJapaneseGreetingCards
pbWizardJapaneseInvitations
pbWizardJapaneseLabels
pbWizardJapaneseLetterheads
pbWizardJapaneseMenus
pbWizardJapaneseNewsletters
pbWizardJapaneseOrigami
pbWizardJapanesePostcards
pbWizardJapanesePrograms
pbWizardJapaneseSigns
pbWizardJapaneseWebSites
pbWizardLabels
pbWizardLetterheads
pbWizardMenus
pbWizardNewsletters
pbWizardNone default
pbWizardOrigami
pbWizardPostcards
pbWizardPrograms
pbWizardQuickPublications
pbWizardResumes
pbWizardSigns
pbWizardWebSites
pbWizardWithComplimentsCards
pbWizardWordDocument

Design   Optional Long. The design to apply to the new publication.

Example

This example creates a new publication and edits the master page to contain a page number in a star in the upper left corner of the page.

Sub CreateNewPublication()
    Dim AppPub As Application
    Dim DocPub As Document

    Set AppPub = New Publisher.Application
    Set DocPub = AppPub.NewDocument
    AppPub.ActiveWindow.Visible = True

    With DocPub.MasterPages(1).Shapes.AddShape _
            (Type:=msoShape5pointStar, Left:=36, _
            Top:=36, Width:=50, Height:=50)
        .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
        With .TextFrame.TextRange
            .InsertPageNumber
            .ParagraphFormat.Alignment = pbParagraphAlignmentCenter
            With .Font
                .Bold = msoTrue
                .Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
                .Size = 12
            End With
        End With
    End With
End Sub