Muokkaa

Jaa


Document.CreateLetterContent method (Word)

Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.

Syntax

expression. CreateLetterContent( _DateFormat_ , _IncludeHeaderFooter_ , _PageDesign_ , _LetterStyle_ , _Letterhead_ , _LetterheadLocation_ , _LetterheadSize_ , _RecipientName_ , _RecipientAddress_ , _Salutation_ , _SalutationType_ , _RecipientReference_ , _MailingInstructions_ , _AttentionLine_ , _Subject_ , _CCList_ , _ReturnAddress_ , _SenderName_ , _Closing_ , _SenderCompany_ , _SenderJobTitle_ , _SenderInitials_ , _EnclosureNumber_ , _InfoBlock_ , _RecipientCode_ , _RecipientGender_ , _ReturnAddressShortForm_ , _SenderCity_ , _SenderCode_ , _SenderGender_ , _SenderReference_ )

expression Required. A variable that represents a Document object.

Parameters

Name Required/Optional Data type Description
DateFormat Required String The date for the letter.
IncludeHeaderFooter Required Boolean True to include the header and footer from the page design template.
PageDesign Required String The name of the template attached to the document.
LetterStyle Required WdLetterStyle The document layout.
Letterhead Required Boolean True to reserve space for a preprinted letterhead.
LetterheadLocation Required WdLetterheadLocation The location of the preprinted letterhead.
LetterheadSize Required Single The amount of space (in points) to be reserved for a preprinted letterhead.
RecipientName Required String The name of the person who'll be receiving the letter.
RecipientAddress Required String The mailing address of the person who'll be receiving the letter.
Salutation Required String The salutation text for the letter.
SalutationType Required WdSalutationType The salutation type for the letter.
RecipientReference Required String The reference line text for the letter (for example, "In reply to:").
MailingInstructions Required String The mailing instruction text for the letter (for example, "Certified Mail").
AttentionLine Required String The attention line text for the letter (for example, "Attention:").
Subject Required String The subject text for the specified letter.
CCList Required String The names of the carbon copy (CC) recipients for the letter.
ReturnAddress Required String The text of the return mailing address for the letter.
SenderName Required String The name of the person sending the letter.
Closing Required String The closing text for the letter.
SenderCompany Required String The company name of the person creating the letter.
SenderJobTitle Required String The job title of the person creating the letter.
SenderInitials Required String The initials of the person creating the letter.
EnclosureNumber Required Long The number of enclosures for the letter.
InfoBlock Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
RecipientCode Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
RecipientGender Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
ReturnAddressShortForm Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SenderCity Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SenderCode Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SenderGender Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SenderReference Optional Variant This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Return value

LetterContent

Example

The following example uses the CreateLetterContent method to create a new LetterContent object in the active document and then uses this object with the RunLetterWizard method.

Set myLetter = ActiveDocument _ 
 .CreateLetterContent(DateFormat:="July 31, 1996", _ 
 IncludeHeaderFooter:=False, PageDesign:="", _ 
 LetterStyle:=wdFullBlock, Letterhead:=True, _ 
 LetterheadLocation:=wdLetterTop, _ 
 LetterheadSize:=InchesToPoints(1.5), _ 
 RecipientName:="Dave Edson", _ 
 RecipientAddress:="436 SE Main St." & vbCr _ 
 & "Bellevue, WA 98004", _ 
 Salutation:="Dear Dave,", _ 
 SalutationType:=wdSalutationInformal, _ 
 RecipientReference:="", MailingInstructions:="", _ 
 AttentionLine:="", Subject:="End of year report", _ 
 CCList:="", ReturnAddress:="", _ 
 SenderName:="", Closing:="Sincerely yours,", _ 
 SenderCompany:="", SenderJobTitle:="", _ 
 SenderInitials:="", EnclosureNumber:=0) 
ActiveDocument.RunLetterWizard LetterContent:=myLetter

See also

Document Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.