Wizard


MailMerge.ShowWizard

Displays the Mail Merge Wizard in a document.


expression.ShowWizard(InitialState, _ 
    ShowDocumentStep, _
    ShowTemplateStep, _
    ShowDataStep, _
    ShowWriteStep, _
    ShowPreviewStep, _
    ShowMergeStep)

expression Required. An expression that returns a MailMerge object.
InitialState - Required Variant. The number of the Mail Merge Wizard step to display.
ShowDocumentStep - Optional Variant. True keeps the "Select document type" step in the sequence of mail merge steps. False removes step one.
ShowTemplateStep - Optional Variant. True keeps the "Select starting document" step in the sequence of mail merge steps. False removes step two.
ShowDataStep - Optional Variant. True keeps the "Select recipients" step in the sequence of mail merge steps. False removes step three.
ShowWriteStep - Optional Variant. True keeps the "Write your letter" step in the sequence of mail merge steps. False removes step four.
ShowPreviewStep - Optional Variant. True keeps the "Preview your letters" step in the sequence of mail merge steps. False removes step five.
ShowMergeStep - Optional Variant. True keeps the "Complete the merge" step in the sequence of mail merge steps. False removes step six.


This example checks if the Mail Merge Wizard is already displayed 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

MailMerge.WizardState

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.


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


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrev