clhare
12-05-2012, 07:33 AM
I have a template that I have stored in the Program Files startup folder (and I've added that location to the Trust Locations in Word 2010). I have several AutoText entries stored in that template that I want to be able to access while in any Word 2010 document. I tried the following code, but it only works if I am in the "My Macros.dotm" file. I can insert the AutoText if I do it manually, but not through this macro (I get a runtime error that says the member of the collection doesn't exist).
What do I need to do to get this macro to work for any document?
Sub InsertAutoText()
Application.Templates( _
"C:\Program Files\Microsoft Office\Office14\STARTUP\My Macros.dotm" _
).BuildingBlockEntries("TestAT").Insert Where:=Selection.Range, _
RichText:=True
End Sub
What do I need to do to get this macro to work for any document?
Sub InsertAutoText()
Application.Templates( _
"C:\Program Files\Microsoft Office\Office14\STARTUP\My Macros.dotm" _
).BuildingBlockEntries("TestAT").Insert Where:=Selection.Range, _
RichText:=True
End Sub