WizardState Property

Microsoft Word Visual Basic

WizardState Property

       

Returns or sets a Long indicating the current Mail Merge Wizard step for a document. The WizardState method returns a number that equates to the current Mail Merge Wizard step; a zero (0) means the Mail Merge Wizard is closed. Read/write.

expression.WizardState

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

Example

This example checks if the Mail Merge Wizard is already displayed in the active document and if it is, moves to the Mail Merge Wizard's sixth step and removes the fifth step from the Wizard.

Sub ShowMergeWizard()
    With ActiveDocument.MailMerge
        If .WizardState > 0 Then
            .ShowWizard InitialState:=6, ShowPreviewStep:=False
        End If
    End With
End Sub