[INDENT]I am working at a site that has a number of PCs running Word 2000 (yes, I know, they’re going to upgrade soon). There is a large number of Word templates, which are selected, opened and automated using VBA.
Some of these templates insert AutoText that is stored within the relevant template (as opposed to a global template). The template text contains the names of a number of AutoText entries, and depending on selections in a dialog box, the AutoText names are deleted if not required, or expanded to the full entries using the Selection.Range.InsertAutoText command, which has worked for some time with no difficulty.
Recently, however, some (but not all) PCs get a run-time error (5906 – The range does not specify a known AutoText entry) when the first InsertAutoText command is encountered. I have manually opened a document based on the template, gone to any of the listed AutoText entries and tapped F3; on the PCs that get the run-time error, the AutoText is not inserted, and the Status Bar shows the message “The specified text is not a valid AutoText name. Use Insert AutoText to create AutoText entries.”; on the PCs that don’t get the run-time error, F3 works as expected and the AutoText name is replaced by the full entry.
If, on one of the PCs giving the error, I use the Insert AutoText menu steps, I can find the AutoText name and insert the full entry. If I close the template, the AutoText name is no longer available on the Insert AutoText list, thus eliminating the possibility that there is a duplicate AutoText name somewhere in a global template.
I get the same results if I actually open the template, as when I open a document based on the template.
If I key in the name of one of the AutoText entries in Normal.dot, F3 works exactly as I expect it to on all PCs. So the problem only seems to apply to AutoText stored in the current template.
Some of the PCs displaying the problem are Word 2000 (9.0.6926 SP-3) and some of those that work OK are Word 2000 (9.0.3821 SR-1). Bingo! I thought I had identified the problem. Until I went to a PC where it works and found it was identical to those that don’t work (ie 9.0.6926 SP-3). At that point I decided not go to go every PC in the 4 floors of the office until determining whether anyone has encountered this problem and knows of some setting I need to fix on the recalcitrant PCs.
I have looked at Tools, Customize, Keyboard… and F3 is definitely allocated to InsertAutoText (as is Alt+Ctrl+V, which is doing exactly the same as F3 and the VBA InsertAutoText command on the problem PCs) (and I checked both ways – looked at InsertAutoText to see what was listed, then tried allocating F3 and Alt+Ctrl+V to something else to check that it told me what they were currently allocated to). I have checked the Compatibility options, checked that they all have the same settings in Tools Options, File Locations and Tools, Templates and Add-ins, and that they all have the same generic AutoText (not those causing the problems) in their Normal.dot files.
Now, I know I can fix the automation problem by picking up the word immediately preceding the insertion point, storing it in a variable such as “ThisAutoTextName” and substituting “NormalTemplate.AutoTextEntries(ThisAutoTextName). Insert Where:= Selection.Range” for “Selection.Range.InsertAutoText”. However, this would need to be done in several places in a reasonably large number of templates, and with an impending upgrade of the software, and accompanying full review of all the templates, it’s an exercise I’d be happy to avoid if I can find out the reason why some of the PCs in this site work fine, and adjust the offending PCs accordingly.
Thanks and regards
Alison C
(really sorry they no longer have the banging-your-head-on-a-brick-wall smiley) [/INDENT]