Microsoft KB Archive/205539

= WD97: Recorded Macro Doesn't Insert Frame Contained in AutoText Entry =

Article ID: 205539

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Word 97 Standard Edition

-



This article was previously published under Q205539





SYMPTOMS
When you record a macro to insert an AutoText entry containing a frame, Microsoft Word does not insert the frame when you run the macro.

For example, the following recorded macro does not insert the frame contained in the specified AutoText entry: Sub InsertMyAutoText

Application.DisplayAutoCompleteTips = True NormalTemplate.AutoTextEntries("AutoTextName").Insert _ Where:=Selection.Range

End Sub NOTE: "AutoTextName" is the name of your AutoText entry.



CAUSE
The RichText property is not recorded automatically when you record the macro. You must manually add the RichText property to your macro code and set it to True.

For more information about the RichText property, from the Visual Basic Editor, click the Office Assistant, type richtext, click Search, and then click to view "RichText Property."



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

173707 OFF97: How to Run Sample Code from Knowledge Base Articles

To correct this problem, add the RichText property to your recorded macro. Your macro code should look similar to the following example: Sub InsertMyAutoText

Application.DisplayAutoCompleteTips = True Normaltemplate.Autotextentries("AutoTextName").Insert _ Where:=Selection.Range, RichText:=True

End Sub



MORE INFORMATION
For more information about creating and storing AutoText entries, click Contents and Index on the Help menu, click the Index tab in Word Help, type the following text

autotext

and then double-click the selected text to go to the "Use shortcuts to insert frequently used text and graphics" topic. If you are unable to find the information you need, ask the Office Assistant.

For more information about recording a macro, click Contents and Index on the Help menu, click the Index tab in Word Help, type the following text

macros, creating

and then double-click the selected text to go to the "Create a macro" topic. If you are unable to find the information you need, ask the Office Assistant.

For additional information about getting help with Visual Basic for Applications, click the article numbers below to view the articles in the Microsoft Knowledge Base:

163425 WD97: Macro Programming Resources

163435 VBA: Programming Resources for Visual Basic for Applications

Additional query words: vb vba vbe

Keywords: kbautotext kbframe kbmacroexample kbprb KB205539

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.