I am having a problem with some code that was working and has stopped. Maybe I am missing something obvious but this is the scenario.
MS Word 97 starts with a template XYZ.dot stored in C:Program FilesMicrosoft OfficeOfficeStartup folder. (It contains all code, AutoText, custom toolbars, etc.) Code is run from the custom toolbar buttons each creating a new document based on a relevant template stored in the C:Program FilesMicrosoft OfficeTemplates folder.
The following code WAS working but some assigned keyboard shortcuts gave up and so to clean up the XYZ.dot template I recreated it and copied all the code, AutoText, custom toolbars, etc. using the Organizer faithfully copying all across to the new copy of XYZ.dot.
An experienced user then noted that the keyboard shortcuts were not working. I deleted all four, recreated them and they worked, even though they appear to be exactly as they were. Now the following code is not working for adding some information to a Memo. It uses a bookmark (it exists in the copy of the Memo.dot) and an AutoText entry (from the globally loaded XYZ.dot).
Public Sub MAIN() ActiveDocument.Bookmarks("res").Select ActiveDocument.AttachedTemplate = "C:Program FilesMicrosoft OfficeOfficeStartupXYZ.dot" ActiveDocument.AttachedTemplate.AutoTextEntries("response").Insert _ where:=Selection.Range, RichText:=True ActiveDocument.Bookmarks("Start").Select End Sub
This brings up the error ” Run-time error ‘438’ Object doesn’t support this method or property ”
Any suggestions?
Leigh