DocumentBase.RunLetterWizard Method

Runs the Letter Wizard on the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub RunLetterWizard ( _
    ByRef letterContent As Object, _
    ByRef wizardMode As Object _
)
public void RunLetterWizard(
    ref Object letterContent,
    ref Object wizardMode
)

Parameters

  • wizardMode
    Type: System.Object%

    true to display the Letter Wizard dialog box as a series of steps with Next, Back, and Finish buttons. false to display the Letter Wizard dialog box as if it were opened from the Tools menu (a properties dialog box with an OK button and a Cancel button). The default value is true.

Remarks

Use the CreateLetterContent method to return a LetterContent with various letter element properties specified. Use the GetLetterContent method to return a LetterContent based on the contents of the document. You can use the resulting LetterContent with the RunLetterWizard method to set elements in the Letter Wizard dialog box.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Examples

The following code example gets a LetterContent by calling the CreateLetterContent method, and then sends this LetterContent as a parameter to the RunLetterWizard method. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentRunLetterWizard()

    Dim LetterContent As Object = Me.CreateLetterContent( _
        DateFormat:=DateTime.Now.ToShortDateString(), IncludeHeaderFooter:=False, _
        PageDesign:=String.Empty, LetterStyle:=Word.WdLetterStyle.wdFullBlock, _
        Letterhead:=True, LetterheadLocation:=Word.WdLetterheadLocation.wdLetterTop, _
        LetterheadSize:=25, RecipientName:="Don Hall", _
        RecipientAddress:="100 Main St." + ControlChars.NewLine + "AnyTown, USA", _
        Salutation:="Dear Dave,", SalutationType:=Word.WdSalutationType.wdSalutationInformal, _
        RecipientReference:=String.Empty, MailingInstructions:=String.Empty, _
        AttentionLine:=String.Empty, Subject:="End of year report", CCList:=String.Empty, _
        ReturnAddress:=String.Empty, SenderName:=String.Empty, Closing:="Sincerely yours,", _
        SenderCompany:=String.Empty, SenderJobTitle:=String.Empty, _
        SenderInitials:=String.Empty, EnclosureNumber:=0)

    Me.RunLetterWizard(LetterContent, True)
    Me.SetLetterContent(LetterContent)
End Sub
private void DocumentRunLetterWizard()
{
    object LetterContent = this.CreateLetterContent(
        DateTime.Now.ToShortDateString(), false, 
        String.Empty, Word.WdLetterStyle.wdFullBlock, true,
        Word.WdLetterheadLocation.wdLetterTop, 24, "Don Hall",
        "100 Main St.\nAnytown, USA",
        "Dear Dave,", Word.WdSalutationType.wdSalutationInformal,
        String.Empty, String.Empty, String.Empty, "End of year report",
        String.Empty, String.Empty, String.Empty, "Sincerely yours,",
        String.Empty, String.Empty, String.Empty, 0, ref missing,
        ref missing, ref missing, ref missing, ref missing, ref missing, 
        ref missing, ref missing);

    object WizardMode = true;

    this.RunLetterWizard(ref LetterContent, ref WizardMode);
    this.SetLetterContent(ref LetterContent);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace