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
Additional query words: vb vba vbe
Keywords: kbautotext kbframe kbmacroexample kbprb KB205539