Share via


Document.MailMergeWizardStateChange Event

Definition

Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.

public:
 event Microsoft::Office::Tools::Word::MailMergeWizardStateChangeEventHandler ^ MailMergeWizardStateChange;
event Microsoft.Office.Tools.Word.MailMergeWizardStateChangeEventHandler MailMergeWizardStateChange;
member this.MailMergeWizardStateChange : Microsoft.Office.Tools.Word.MailMergeWizardStateChangeEventHandler 
Event MailMergeWizardStateChange As MailMergeWizardStateChangeEventHandler 

Event Type

Examples

The following code example displays a message each time you advance to the next step in the Mail Merge Wizard. This example is for an application-level add-in.

private void DocumentMailMergeWizardStateChange()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.MailMergeWizardStateChange += new Microsoft.Office.Tools.Word.MailMergeWizardStateChangeEventHandler(ThisDocument_MailMergeWizardStateChange);
}

void ThisDocument_MailMergeWizardStateChange(object sender, Microsoft.Office.Tools.Word.MailMergeWizardStateChangeEventArgs e)
{
    System.Windows.Forms.MessageBox.Show("Wizard has moved to next step.");
}
Private Sub DocumentMailMergeWizardStateChange()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.MailMergeWizardStateChange, AddressOf ThisDocument_MailMergeWizardStateChange
End Sub

Private Sub ThisDocument_MailMergeWizardStateChange(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.MailMergeWizardStateChangeEventArgs)
    System.Windows.Forms.MessageBox.Show("Wizard has moved to next step.")
End Sub

Remarks

Set the Handled property of the provided MailMergeWizardStateChangeEventArgs to false to have the user remain at the current step.

Applies to