View Full Version : Microsoft Visual Basic - Compile error in hidden module: ThisDrawing.

2012-08-16, 11:15 PM
Hey, a Windows update the other day seems to be causing this error in AutoCAD. I think it is only a problem with the 2007 version of Office products that were updated (two computer are having the problem in the office but had Office 2007 updated the rest are okay and had office 2010 updated). On one of those computers I was able to do a system restore to before the update and everything is now working, however the other didn't have a restore point to go back to. I tried uninstalling all the updates but it still isn't working so I assume it did something with VBA and the references AutoCAD is trying to use.

The first image is what I get when I try to run basically any command (not just custom VBA but line gives the error, quit and so on). The second image is the error I get in the actual custom project (DrawingSettings is a custom form in the project that isn't recognized for some reason). The third image is all the references used by my project, all seem to be in the right place. Is there a way to determine which reference is causing the problem or if the problem is bigger than that?

I've also uninstalled and re-installed AutoCAD Map 3D 2011 multiple times with no luck.

Thanks for any help.866678666886669

Ed Jobe
2012-08-17, 02:11 PM
I would reinstall the vba enabler for acad. There's been a long history of Office messing up vba if its installed after acad. Reinstalling acad won't fix it since the vba enabler is now separate.

2012-08-17, 02:17 PM
Thanks for the reply, sorry I should have mentioned that I did that multiple times as well. There were 3/~15 office updates that I for some reason I wasn't allowed to uninstall also.

Ed Jobe
2012-08-17, 05:05 PM
A second look at the references shows that you have a reference to AutoCAD 2011 AND Map 3D 2005.

2012-08-17, 05:31 PM
The computers that received the update to 2010 version of office also had both these references and are still working okay (also the one that I did a system restore on has this reference is working). Is there anyway to completely remove VBA from my system and start over again from scratch by uninstalling office/autocad/vba enabler and re-installing? I did an uninstall of office and re-install of AutoCAD but it still had the problem. I could be wrong but my best guess is that one of these VBA libraries was compromised by the windows update and uninstalling doesn't remove it and therefore doesn't replace it with the old version when re-installed.

2012-08-17, 05:48 PM
I didn't actually re-install office the first time, I just did that now and it seems to be working. It must have replaced the problem file. Thanks for the help.

2012-08-23, 09:08 AM
I didn't actually re-install office the first time, I just did that now and it seems to be working. It must have replaced the problem file. Thanks for the help.

I solved my issue by following the advice found here:
http://stackoverflow.com/questions/11971358/excel-​vba-automation-errors-due-to-office-service-pack-... (http://stackoverflow.com/questions/11971358/excel-vba-automation-errors-due-to-office-service-pack-3-0-caused-by-forms)

For Windows 7 - remember to run cmd.exe "as administrator", and then:

for 32bit Windows systems:
regsvr32 -u c:\windows\system32\mscomctl.ocx
regsvr32 c:\windows\system32\mscomctl.ocx

for 64bit Windows systems:
regsvr32 -u c:\windows\syswow64\mscomctl.ocx
regsvr32 c:\windows\syswow64\mscomctl.ocx