Compile Error in Module Main

B

Bill Klein

Hello,

I'm getting this very weird eror and cannot figure out why. Anybody able to
help?

What is happening is that there is a series of Word Templates that contain
macros. What happens is there is a main template that has a Menu on the
toolbar that calls several different templates depending on what you selected
in the menu. Most work except at a certain point when the template I selected
tries to call another it gives the "Compile Error in Module: Main". This
happens only if I access them from a network drive but If I copy them locally
everything works fine.

Some further background is that these were initially Word 97 macros and at
some point converted to Word 2000. Now the macros work fine from the network
drive under Windows 2000 but since we are migrating to locked down Windows XP
desktop using Office 2003 when these were tested the error came up.

I've checked the startup folders and nothing is in them but there are a
couple of word templates getting called in but since it is a locked down
desktop I can't remove them. The machine that was testing them initially
should only have the one which is rhd.dot in the C:\Program Files\Microsoft
Office\Remove Hidden Data Tool folder. I've gone into the Templates and
Add-ins section and removed these from there before running the templates but
still get the same problem.

At this point i'm lost, some help would be appreciated.
 
B

Beth Melton

When you encounter the error is the Debug option available? If so then click
Debug and take a look at the macro causing the error. If not then you'll
likely need to find the module named "Main" in every template that could
possibly be responsible for the error and comment the On Error GoTo
statements in each macro. Then when you encounter the error you can click
Debug and determine which macro is causing the error. Until you can pinpoint
the specific macro then there's not a lot you can do.

Also, RHD.dot is the least likey cause - it only contains custom
menus/toolbars and doesn't contain code.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Co-author of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
B

Bill Klein

Thanks for your reply Beth.

When I get the error the actual message is "Compile error in hidden module:
Main" and it give me the option of clicking "Ok" or "Help" when I click Ok it
brings me into the debugger at the beginning of Main module in the one .dot
file.
 
B

Beth Melton

Once you find the template in question, open it and from the Debug menu,
click Compile. This should help pinpoint the error and provide a more
precise error message.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Co-author of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
B

Bill Klein

Since the templates call functions in other templates, what I did was run the
macro and once I got the error and went in the debug mode, I tried to compile
all the templates and they compiled fine.

I'm not convinced that there is a coding error as if I run the templates
locally it works fine, but they don't when I access them from network drive.
 
B

Bill Klein

Sorry for the long time in replying, I got busy with other projects.

I've done some more testing with this problem and have narrowed it down to
the when the functions that are in a Common.dot template file are called from
the template that is throwing the error.

Simplified Example:

Public Sub Start_Conditions(strMessage)
'Do stuff
Common.msgAppend(strMessage)
'Do more stuff
End Sub

If I comment out the Common.msgAppend(strMessage) line I don't get the
error.

As for additional references I dont' see any that shouldn't be there.
 
B

Beth Melton

Where is Common.dot located? It sounds like when the project is on the
network the template can't be found. What happens if you do add the template
as a reference in Tools/References?

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Co-author of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
B

Bill Klein

The Common.dot is located in the parent folder where Main.dot is.

I added the template as a reference as everything seemed to work fine. The
template that launches Main.dot though should be adding the reference
programmatically, it appears that isn't working as intended.

Thanks for your help Beth.
 
B

Bill Klein

One other thing I forgot to mention was that before the Common.dot is
referenced but instead of pointing to the one on the network drive it points
to one in a Temp directory.
 
B

Beth Melton

Adding Common.dot as a reference in Main.dot is a smoother solution than
trying to add it programmatically. :)

I'm not sure why it's pointing to the Temp folder, are you saying it's not
working as expected now?

Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Co-author of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
B

Bill Klein

I meant before the adding of a reference programatically must not be working
properly. Anyways I have added the reference manually and everything seems
to work fine now.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top