Results 1 to 1 of 1
2002-06-09, 12:11 #1
- Join Date
- Feb 2001
- Yilgarn region of Toronto, Ontario
- Thanked 0 Times in 0 Posts
Template references updated (Word97/SR2)
Sunday June 9th 2002
See also Unset a reference via code?
I started this as an excercise, thinly disguised as a challenge: "Modify the two templates and send them back to me so that I can lock them and THEN install them in any directory on my hard drives (C: through L and have them function as they do when unlocked.
I discovered something else: Windows98SE seems to keep track of where I drag my templates!
How the templates work:
The utility template represents any utility or common Word97 template you're ever likely to want. It contains a function (strUtility) which merely passes its argument. Drag the little TEST procedure outside the function, decomment it and run it. Done.
The application represents any Word97 application you're ever going to write. It makes use of a utility library in a template. The application user macro (ApSub) calls the utility function and displays the result.
If you drag both templates to, say, C:TEMP and try to run the application, it will fail (it won't even compile)
If you open the Application template in VBE and choose Tools, References and Browse to where the Utility template is stored (c:temp), change to FilesOfType doc/dot and then select the Utility, confirm and make sure the check box is turned on alongside "Ut", confirm, and THEN try to run the ApSub, you'll see the pop-up message.
Quit Word electing to save files, then reload Word and open the Application template and it should run first time. The reference was "saved" when you saved the template.
At this point I thought that the Reference was somehow locked into the template, but I discovered that if I exit Word, Move/drag the two templates to, say D:temp, and then reload Word and open the application, It WORKS!. This suggested to me that moving a template modifies the content of the template, but I don't believe this to be true; I think that a registry entry is modified to reflect the movement of the template file.
If I open the Application template in VBE and inspect the references, the reference to the utility has been changed to read "D:TEMP" or "I:TEMP", or wherever the template got dragged!
I find that if I drag just the utility template to a new location, the Reference isn't changed and the application fails to work.
Strange. Welcome, but strange!