compile error hidden module

not very bright dave

Board Regular
Joined
Dec 20, 2004
Messages
244
Hi guys

My file works fine when I open it, however, I'm getting this compile message when another user on a different machine tries to open it. I've searched the board and think I understand it to be missing some references when opened on the other person's machine. It doesn't make any sense and it's driving me mad. Does anyone know why?

Thanks in advance

Dave
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
What is the compile message you are receiving? If it has VBA code, if you hit debug what lines does it highlight?
 
Upvote 0
Thanks for coming back to me schielrn

I've figured out that it is a missing OLE automation reference but whenever I try to add this reference in using the following code (which I have to do because we have users all over the country and I can't manage them all manually adding the reference) :

Application.VBE.ActiveVBProject.References.AddFromFile ("c:\windows\system32\stdole2.tlb")

I get an error messsage - name conflicts with existing module, project or object library!

Any ideas?

Cheers
 
Upvote 0
Are you getting this message on a machine that doesn't already have the OLE Automation reference checked? If you are trying it on a machine that already has it installed I would assume it wouldn't work.

If I uncheck the reference box from within the visual basic editor it works, but if I try to run it again it gives me the error. Is that what you are encountering? You may want to put an on error resume next preceding it, just so it doesn't error if someone runs the file a second time.

Hope that helps.
 
Upvote 0
Hi,
I have the same problem when I deliver a file (VBA protected) to my customer. On opening the model, a userform should load automatically but my customers say they have a message 'compile error in hidden module'. In the Excel-file, I have included references for example to OLE Automation and Solver that I suspect my client do not have by default. I cannot go to my client, open the protected VBA code and check those references. Is there a way to install the references to them automatically? The code: Application.VBE.ActiveVBProject.References.AddFromFile ("c:\windows\system32\stdole2.tlb") was mentioned here. Is that the way?
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top