Can't add reference the specified file Word2003

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Can't add reference the specified file Word2003

Post by ChrisGreaves »

How to make Word2010 make a reference to a 2010 dotM library?

I found this post from Charlotte, How to set a reference in Access 2007?, but couldn't find any other mention of this problem.
I am a novice at migrating 2003 VBA code to 2007/2010 templates.

I am at the client site; Word 2010 version 14.0.6123.5001 (32 bit)
At home I run Word 2003.

I have emailed to myself at the client site a copy of my own application template Styles106.dot.
Styles106.dot requires a reference to my own Word 2003 utility library UW.dot.
I save my emailed copy of Styles106.dot as Styles106.dotM on the client's machine.
I emailed to myself at the client site the collection of *.bas, *.frm etc from UW.dot, and cloned a copy of Styles106.dotM and removed all the modules to make an empty UW.dotM, .
I have painfully File, Inserted about fifty modules into UW.dotM, set references to Microsoft Scripting controls et al, and got a clean compile of UW.dotM.

Poured myself a fresh coffee.

Opened my Word 2003 Styles106.dot, now saved as Styles106.dotM.
Chosen Tools, References.
Noted the missing UW.dot
Browsed to the newly-imported UW.dotM.
And get this: :hairout:
untitled.JPG
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.

richardbarrett
NewLounger
Posts: 8
Joined: 07 Feb 2010, 22:39

Re: Can't add reference the specified file Word2003

Post by richardbarrett »

Is UW.dotm loaded? Is it in the Word Startup folder? If so, you should not need to browse for it; it should be listed in the Available References. If it's not loaded, I don't think a dotm file can be used as a Reference. (A document template loads when a document on which it is based is open. When that document is closed, the template unloads. A Startup template is loaded throughout the Word session and available as a Reference.)

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Can't add reference the specified file Word2003

Post by ChrisGreaves »

richardbarrett wrote:Is UW.dotm ... in the Word Startup folder?... I don't think a dotm file can be used as a Reference.
Thanks Richard.
I tried moving UW.dotM to the startup folder, no luck.
I renamed UW.dotM to UW.DOT (for I have been able to load Rob Bovey's Word Code Cleaner.dot to the startup folder and use it successfully.
I rather think that my generated UW.dot[m] is somehow corrupt.
I am working in a secure-paranoid-lockeddown environment.
I note in passing that in MSW I am somewhat restricted in my options to play around with macros; for one thing the computer seems to be re-imaged each boot-up, so I have to be on my toes regarding Trust Centre settings etc.
I'll give it another try later and will report back.
He who plants a seed, plants life.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Can't add reference the specified file Word2003

Post by ChrisGreaves »

richardbarrett wrote:Is UW.dotm loaded? ...
Created a new document, saved it as a Word2003 UW.dot.
Exited MSW.
Reloaded MSW.
Opened UW.dot
Imported a module.
Seemed OK.
Imported remaining modules
Exited MSW.
Reloaded MSW.
Despite the fact that UW.DOT is now 2,031 KB (up from 18KB for the UW.DOTM), the VBE shows no modules loaded!
untitled.PNG
I note that the modules seem to have been stripped out of UW.dot, which shows as only 22KB, whereas the TMP file shows the original 2,031KB.
Exited MSW (save UW.dot)
Reloaded MSW.
This updated text is saved, but the macros are gone.
I save this template as a UW.dotm and exit MSW.
Reload MSW, open UW.DOTM, import a single module “Browsers”, save and exit MSW.
Reload MSW, module “Browsers” is present.
Remove browser (references needed), import UT_Constants (no references needed), clean compile;
Save, exit, reload.
Reopen UW.dotm, module UT_Constants is present.
Close UT.dotm.
Part of my problem hooking up was that I was (15 years habit!) looking for UW in the template project list; I change the name “TemplateProject” to “UW” in the VBE Properties pane.
Save, exit, reload.
In MSW I am presented with a clean document; I open VBE, hook up a reference too UW, and am rewarded with access to the labeled values in the UW module UT_Constants.
HOORAY!
Imported remaining modules
Exited MSW.
Reloaded MSW.
Open UW.dotM, try Alt-F11 and get “File not found”.
I note my UW.dotM is only 35K, which seems way too small for 91 modules totaling (File, Properties) 1.12MB. The VBACodeCleaned UW.dot on my Word2003 system is 2.14MB.
I suspect that something, somewhere, in the 91 modules causes Word2010 to throw a fit. I’ll pursue this, carefully, by a divide-and-conquer approach to loading the 91 modules.
You do not have the required permissions to view the files attached to this post.
He who plants a seed, plants life.