Solved

Compile Error in Hidden Module Running Macros in Word 2010

Posted on 2011-03-16
21
3,418 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

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 150 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 350 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

617 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