Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Compile Error in Hidden Module Running Macros in Word 2010

Posted on 2011-03-16
21
Medium Priority
?
3,567 Views
Last Modified: 2012-06-21
I am testing Word 2010 with our current custom vba macros written for Office 2003.  They are located in a template called legal.dot which loads in the Word startup folder.  When I try to run any macro I get the error: Compile Error in Hidden Module THis error commonly occurs when code is incompatible with the version, platform or architecture of the application.....

I know it is not the code because if I copy all of the macros into my normal.dot & run from there they all run without a problem.  I have the startup folder & the folder where the templates are loading from as a trusted location source but still cannot run?  Any suggestions what I can try?  
0
Comment
Question by:leinig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
  • 4
  • +1
21 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35154051
Ensure all word documents / applications are closed then ...

Try opening the template in word for edit.  Now try and run one of the macros in another document and it should give some indication of what is happening.

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35154184
ALso if the template code is protected, after opening it and before doing anything else nlock the project.

Chris
0
 
LVL 14

Expert Comment

by:Stacy Brown
ID: 35157466
Try resaving your Legal.dot in Word 2010 as a Legal.dotm file.  

Also, check your macro security settings
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

Author Comment

by:leinig
ID: 35157768
Unfortunately neither suggestion above has helped.  Macro Security Settings is set to Enable All.  To clarify a little bit more.  I have one .dot (also tried .dotm) that loads in my Word startup folder called legal.dot.  In it resides numerous custom macros.  That being said & in looking further, the error seems to happen only on the macros that load a form with questions.  For instance we have a macro called ELetter.  All that macro does is call a form (frmelet).  That form just has some questions you answer & once done you click ok it opens a document and populates it with the answers you typed in from the form.  The form loads fine & you can answer all the questions but once you hit ok you receive the Compile in Hidden Module error.  As stated earlier if I take the macros (in this example eletter & frmelet) & put in normal.dotm they run without a problem.  So it has to be something with some kind of permissions or protection of that legal.dot in startup.  Can't imagine what though because I run it this way on 100s of machines using Word 2003 & have tried it on 2007 without issues also??  
0
 
LVL 59

Assisted Solution

by:Chris Bottomley
Chris Bottomley earned 600 total points
ID: 35158310
Neither suggestion helped ... so with the template file open as the first action, aand unprotected you still get a fsil but no breakpoint then repeat with the other template ... a compile error ought to give some info!

Chris
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35162763
leinig: For a faster resolution and keeping the experts from guessing what may have been causing this, could you please upload your file so that we can test it on our machines?

Sid
0
 

Author Comment

by:leinig
ID: 35164992
Ok attaching macro & templates.  Put the one called legaldm.dot in word 2010 startup folder.  put the other dots in folder c:\winword\template (or put them anywhere you'd like and just edit fle path in the macros.  Thanks everyone for all your input so far.  Am going to try and find another machine to put 2010 on here and test there also.   macros.zip
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35165244
There are 6 files in the zip. which ones should we be looking at? 2010legaldm.Dot?

Sid
0
 

Author Comment

by:leinig
ID: 35165648
2010legaldm.dot hold the macros.  the other 5 files are the templates called by the macro
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35166216
Ok I will be using 2010 in another hour or so and then I will test it.

Sid
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35167863
>>>I know it is not the code because if I copy all of the macros into my normal.dot & run from there they all run without a problem.

Well. It is the code :)

In the form "frmelet" in the click event of the optYes, you mentioned

cmbdirectdial.Visible = True

I couldn't find that control.

If you comment out that line like I did below then you will not get any errors :)

I guess you meant cmbdelivery and not cmbdirectdial?

Sid

Private Sub optYes_Click()
    If Optyes.Value = 1 Then
        Txtdirdial.Visible = True
        Lblchoose.Visible = True
        Lbldirdial.Visible = True
        txtinitials.Visible = True
   
    Else
        Txtdirdial.Visible = False
        Lbldirdial.Visible = False
        Lblchoose.Visible = False
        'cmbdirectdial.Visible = True
    End If
End Sub

Open in new window

0
 

Author Comment

by:leinig
ID: 35168219
I will give it a try.  I did not write all of these macros & the ones I did were written years ago.  I didn't even check the code because as I mentioned if I put the macros into normal.dot they all ran without an issue.  I will check this out on Monday & post results.

Thanks.
0
 

Author Comment

by:leinig
ID: 35168419
Web-ex I was participating in ended early.  I commented out that line.  reloaded legaldm.dot.  Run the Eletter macro.  Same issue.  
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35168561
Check if all control names are correct. Also check the exact thing that you are doing when you get an error for example what and where do you click when that error happens?

Sid
0
 

Author Comment

by:leinig
ID: 35168741
I will examine code on Monday.  I don't receive the error until I click OK on the form which essentially is pulling in the .dot & then populating the fields on that .dot with the stored info from the form variables.  Thanks.  
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35170471
There are many coding errors in that file.

For example

.name = Arial

should be

.name = "Arial"

I am going through all the files and it may take some time.

Sid
0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 1400 total points
ID: 35170495
Ok to summarize it.

In document 2010legaldm.dot

Replace  

.Alignment = wdAlignParagraphFull

with

.Alignment = wdAlignParagraphCenter

as the constants available are

   wdAlignParagraphLeft
   wdAlignParagraphCenter
   wdAlignParagraphRight
   wdAlignParagraphJustify

Similarly for

.name = TimesNewRoman

Change that to

.name = "TimesNewRoman"

I have updated the file. Please test it for me.

Sid


2010legaldm.dot
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35170504
Also one last thing

Also in the Form "frmletter" and "frmletterNew", comment the line

cmbdirectdial.Visible = True

That should take care of all the errors in that file.

Sid
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35171225
Assuming that is the lot then well done Sid, I must admit to losing interest when there was no errors being reported and no response to my comment to check the second file.

Looks like there were just a few errors to be found!

Chris
0
 
LVL 30

Expert Comment

by:SiddharthRout
ID: 35171235
Yeah there were many errors. I am surprised when the OP says that there was no errors in the earlier versions as those errors will error out in any version.

The only thing is that I have to switch between OS to test the files out.

Sid
0
 

Author Comment

by:leinig
ID: 35183612
I appreciate everyone's time looking at this.  Downloaded file & it appears to work so thank you.  I want to reiterate that these macros are used all day long here in Word 2003 exactly as they exist in the template I provided you along with dozens of others with no issues.

I did open the file as suggested Chris and did see an error on the font name but before I could post results Sid was assisting & making suggestions.  Also as indicated earlier I did not write all of these macros and the ones I originally did write were way back in Word 2000 days so again I apologize for not understanding where the issues were.  I am a novice self-taught at best.  Hence my coming to the experts.  
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question