Share via


DocumentBase.RunLetterWizard 方法

在文件上執行 [信件精靈]。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

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

參數

  • wizardMode
    型別:System.Object%
    true 表示利用 [下一步]、[上一步] 和 [完成] 按鈕進行一系列步驟,藉此顯示 [信件精靈] 對話方塊。false 表示從 [工具] 功能表開啟而顯示 [信件精靈] 對話方塊 (具有 [確定] 按鈕和 [取消] 按鈕的屬性對話方塊)。預設值為 true。

備註

使用 CreateLetterContent 方法,利用指定的信件項目屬性傳回 LetterContent。 使用 GetLetterContent 方法,根據文件的內容傳回 LetterContent。 您可以使用產生的 LetterContent 搭配 RunLetterWizard 方法,設定 [信件精靈] 對話方塊中的項目。

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例會透過呼叫 CreateLetterContent 方法取得 LetterContent,然後傳送此 LetterContent 做為 RunLetterWizard 方法的參數。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間