![using autotext in outlook 2010 using autotext in outlook 2010](https://www.officetooltips.com/images/tips/3_2003/1.png)
Set the Company line to bold and type in that content If strCompany "" Then 'If Company field has content _ TypeText Text:=strTitle & strInitial & strSurname Style = ActiveDocument.Styles("Inside Address") With Selection ' type in the name string _ "MMMM" & Chr(160) & "yyyy", InsertAsField:=False InsertDateTime DateTimeFormat:="d" & Chr(160) & _ With Selection 'Insert the current date _įormatted with the date paragraph style and UK pattern switch StrInitial = "" 'otherwise set initial to nul 'If forename exists then extract initial and add a period (full stop). MsgBox "User cancelled or no address listed",, "Cancel" 'And assign the required components to variables Make it a relatively simple task to modify it to your personal requirements. The date is inserted in UK format and the macro is laid out and documented to Modify these styles to format the layout of the inserted items. The following macro uses paragraph styles which must be present in your template: The following variation adds formatting, user prompts date, and variable text dependent on the field content from Outlook to fully automate a personal/business letter template. StrFinal = strFinal & vbCr & strCompany _ StrFinal = strTitle & Left(strForeName, 1) & ". If strForeName "" Then 'extract initial from forename StrAddress = Application.GetAddress("", strAddress, _ StrCompany = Application.GetAddress("", strCompany, _ StrSurname = Application.GetAddress("", strSurname, _ StrForeName = Application.GetAddress("", strForeName, _ StrTitle = Application.GetAddress("", strTitle, _ 'Let the user choose the contact from Outlook Possible to simply eliminate abandoned spaces where the field in question contains no data. It is possible to use the same curly brackets that you might use when creating anĪddressLayout autotext, to format the insertion ofĪddresses when gathering and inserting data using VBA.
Using autotext in outlook 2010 code#
Macro Code to insert name and address from Outlook (with title and initial) However remain available to Word, though whether there is anyīenefit from using it is hard to say. That Word can create is now obsolete, so it was removed from theĮnvelope dialog starting in Word 2007. "BARCODE sZip \b", PreserveFormatting:=True Selection.Collapse Direction:=wdCollapseEnd 'Move to the end of the address and add the barcode
![using autotext in outlook 2010 using autotext in outlook 2010](https://cdn.ablebits.com/_img-blog/quick-parts/quick-part-edit-properties.png)
Selection.MoveUp Unit:=wdLine, Count:=3, Extend:=wdExtendĪ Range:=Selection.Range, Name:="sZip" 'The following section for American users inserts a bar code 'Insert the modified address at the current insertion point StrAddress = Left(strAddress, iDoubleCR - 1) & Mid(strAddress, iDoubleCR + 1)
![using autotext in outlook 2010 using autotext in outlook 2010](https://pcsavior.org/wp-content/uploads/2021/12/how-to-search-all-archive-folders-in-outlook-2.png)
IDoubleCR = InStr(strAddress, vbCr & vbCr) 'Eliminate blank lines by looking for two carriage returns in a row StrAddress = Application.GetAddress("", strCode, False, 1,, , True, True) 'Let the user choose the name from Outlook In Word 2000/3 you get the following dialogs: Having pressed Alt F3 what happens next is determined by the Word version. there will be no blank line between the name and the address. Thus if there is noĬompany Name associated with the contact. Or spaces in the address should one or other component be missing. They are used in the manner shown to omit blank lines Shown in the example above are not fields but place markers. } Note that despite Word's familiar use of the curly bracket as aįield boundary (see, for example, the macrobutton examples below), the curly brackets The following example adds the otherwise missing Company Name to the address (if present in the chosen record). This is achieved in any Word versionīy entering the following layout in a Word document, selecting it and pressing (see the list below) formatted as an autotext entry with the reserved name ofĪddressLayout. The format of the inserted address may not be what you require and to some extent youĬan modify that layout to your personal requirements using the Tool present in all recent versions of Word to insert addresses into documents and envelopes.
Using autotext in outlook 2010 windows#
Provided Outlook is the Windows default e-mail application, you can use the Insert Address Insert address from OutlookĪlthough nothing to do with Macrobutton fields, as the following uses the same formats as the macrosĭemonstrated later, I felt it appropriate to include the standard function to insert Outlook addresses here. NormalTemplate.BuildingBlockEntries("Unchecked Box").Insert _ĭouble clicking the field will replace it with the alternative version. NormalTemplate.BuildingBlockEntries("Checked Box").Insert _