Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!
Subscribe for Free Excel tips & more!

Compile Error In Hidden Module: Thisworkbook

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

You mighthave an add-in under tools>add-ins associated with Project, if you
can't figure out which uncheck all add-ins, then restart excel, if the
problems go away check one at a time (and close and restart excel) until you
get the error again, then you know which one it is and can uncheck ity. Or
you might have something in your xlstart folder, check there as well and
remove anything and restart to see if problem persists.


peo sjoblom

"Lloyd" wrote:

> My company currently uses Office XP SP2 and Project 2000 SR1. When we
> uninstall Project 2000, and try opening Excel, we receive the following error
> message:
> Compile error in hidden module: ThisWorkbook
> Can you tell us why are we receiving this error. I looked at Tools -
> References and did not notice anything missing.
> Thanks in advance.

View Answers     

Similar Excel Tutorials

Delete Hidden Rows in a Workbook
This macro will delete hidden rows from every worksheet in an entire workbook. However, note that this will only d ...
Delete Hidden Worksheets
This macro will delete all hidden worksheets within a workbook. When you run this macro a warning window will pop ...
Chart Hidden Data in Excel
How to show data from hidden rows and columns on a chart in Excel. When you hide rows or columns of data, a chart ...
Hide Formulas in a Worksheet and Prevent Deletion
This macro will hide all formulas within a workbook and not allow them to be deleted. The page will not be protect ...

Helpful Excel Macros

Delete a VBA Module From Excel
- Delete a VBA macro module from Excel with this macro. This macro allows you to fully remove a macro module from Excel.
Excel Macro to Save a Specific Worksheet as a New File
- This Excel Macro allows you to save a specific worksheet within the Excel Workbook to its own new file. You will be a
Delete All Chart Sheets in Excel - Only Chart Sheets are Deleted - Not Embedded Charts
- Delete all chart sheets and tabs in Excel using this macro. This will only delete the charts and graphs that are in the
Macro to add a New Line to Message Box Pop-up Windows in Excel
- This is a very simple Message Box, pop-up window, macro for Excel that illustrates how to put new lines, the same thi
Save the Current Worksheet as a New Excel Workbook File
- This Excel Macro will save the currently visible/active worksheet (the one that you see when you run the macro) to a

Similar Topics


I am running M S Office 2003 on Vista Home Premium.
Suddenly. i have started getting the error

Compile Error In Hidden Module : Thisworkbook

while opening excel.

Pl. help.



I keep getting that message everytime I open and then close excel. I think it has something to do with Acrobat as it started once I loaded Acrobat onto my computer but I do not know how to make it go away. Word and Powerpoint work just fine.

When I click on HELP next to it, I get the following message:

Compile error in hidden module: (module name)
A protected module cannot be displayed. The error has the following cause and solution:
- There is a compilation error in the code of the specified module, but it cannot be displayed because the project is protected.
- Unprotect the project and then run the code again to view the error
For additional information, slect the item in question and press F1.

I am not technical at all and totally unsure of what to do. Any help would be much appreciated.


I have problem opening an Excel file. It comes up with "Visual Basic" error
window, and the error message is "Module not found".

I'm using Excel 2000 on Windows 98.

Help provides following info. about the error -
Module not found

Modules aren't loaded from a code reference — they
must be part of the project. This error has the
following cause and solution:

The requested module doesn't exist in the specified
project. For example, the statement MyModule.SomeVar =
5 generates this error when MyModule isn't visible in
the project MyProject.
See your host application documentation for
information on including the module in the project.

Excel file is provided by a friend who uses Mac, and I think it contains
some macros.

Any idea? Thanks in advance.

I receive an error when I open excel stating: "
Compile error in hidden module: AutoExecNew" and I receive an error message
when I exit excel which states "Compile error in hidden module: DistMon."
It does not report any error to the event log. Any help in fixing these error
would be greatly appreciated. Thanks.

Each time I open or close Excel I receive the following error
Microsoft Visual Basic
Compile error in hidden module: DistMon

I am not sure how to fix this?[/img]

In my excel file i have a module that when i save the document that module runs and deletes the code located in "ThisWorkbook".
The problem is: in office 2007 works just fine, but in office 2003 i get un error message.
The code is:


Sub DeleteWorkbookEventCode()
''Needs Reference Set To _
    "Microsoft Visual Basic For Applications Extensibility"
    With ThisWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule
            .DeleteLines 1, .CountOfLines
    End With
End Sub

The bold part of the code seems to be the problem.
The message i receive is:
run-time error '1004':
Programmatic access to Visual Basic Project is not trusted.
Is there any solution for this?

I have looked at similar posts but they don't help, mailnly because I don't understand the technical data/code.
The box appears every time I start Excel, first it was with Version 2003 and now it's the same in 2007!
The full texts are;
compile error in hidden on opening and;
Compile error in hidden module: dist.mon on closing.
I've looked for the two sub text's names but Vista search engine is so ridiculous as to be useless as far I can see.
Any help for someone who is just an end user, like Paddington Bear, " A bear of little brain".
I have tried re-installing Excel, didn't help.


I have a Windows XP laptop with Office 2003 installed. When you launch Excel
a Visual Basic error comes up and says "Compile error in hidden module:
AutoExecNew" Can anyone tell me how to fix this problem? I looked at the
knowledgebase and it says it has to do with an Adobe update. I tried
updating Adobe, I tried uninstalling Adobe, I tried uninstalling and
reinstalling Office, and nothing gets rid of the error.
Any suggestions are greatly appreciated!

Thanks in advance!


I have a new client company using a model whose core macros were developed about seven years ago and have been used successfully by well over 1,000 users. (Not to brag - just to illustrate that I don't think it's anything in the VBA code that is the problem.)

Several users at this new company are getting Compile Errors when they attempt to use the first macro. Other users are not having the problem at all. The new company is very small, has no IT dept to speak of, and is very primitive in their Excel use. (Don't know if this is related, but the users who have the problem are both on Excel 2003, and had their macro security settings set to High. I had them reset to 'Medium' and restart Excel.)

I've seen this problem before, so I sent a copy with the VBA code unprotected to one of the users who was experiencing the problems, and asked him to go to the Tools, References so he could check-mark the missing files. But for him 'Tools, References' is grayed out.

So I had him close my model, open a blank one, and go into VBA to check Tools, References. It wasn't grayed out then, and there are a few DLL files I have checked on my PC that weren't even included on his list of options (Microsoft Forms 2.0 Object Library and Ref Edit Control). So I had him use the Browse feature to locate these two files, add them to his list and check them. Then reopen my model --

Same problem, and the Tools, References are still grayed out so I couldn't tell if the 'fix' took or not. then we closed my model, opened a new blank one, and rechecked Tools References -- but the newly-added DLL references weren't there.

Can anyone explain what's going on and what I can do to fix it?

hi excel gurus!

i m working on an excel 2007 workbook with ms project functionality. in order to be able to use ms project from within excel i m using early binding. for those who dont know what early binding is:

this works fine if the user has ms project installed on his/her pc.

if the user does not have ms project installed i remove the broken references. this works fine.

but my problem is that when i remove the reference to ms project, my vba project will not compile correctly. thus each time when a user opens the workbook the user gets a "compile error in hidden module" , since the functions of ms project are not available.

for example i get a compile error in the following source code:


Public Function getResID(ResName As String, ActiveProject As Project) As Integer
    Dim res As Resource
    For Each res In ActiveProject.Resources
        If = ResName Then
            getResID = res.ID
            Exit Function
        End If
        getResID = -1
End Function

i just want to know what i can do to prevent the compile error? would the use of late binding remove the problem? actually i dont want to use late binding since my source code is already very complex and it would be a huge effort to change it..

would be thankful for any help!

kind regards

Hello everybody,

Is it possible to show a message box when a workbook is opnened in version 2010?
I would like to give users some instructions for an error that occurs when opening in 2010.

Some features I used aren't recognized in 2010 and gives the error:
"Compile Error: Can't find project or library"

This can be solved by following these instructions:
1. Open the database or application.
2. Open a module in Design view or press ALT+F11 to switch to the Visual Basic Editor.
3. On the Tools menu, click References.
4. Clear the check box for the type library or object library marked as "Missing:"

Even better still would be if these steps can be done utomatically

Hello there. I have an issue regarding PHStat2. I managed to install it successfully, but whenever I try to access it, after I enable the macros, I get the message: "Compile error in hidden module: This Workbook" and further "A protected module can't be displayed. This error has the following cause and solution:

There is a compilation error in the code of the specified module, but it can't be displayed because the project is protected.
Unprotect the project, and then run the code again to view the error."

Any ideas how to solve it? I really need to use PHStat2 as I have an exam soon. Thanks in advance.

Hello, Just need some direction in figuring out why I have a compile error in hidden module :ThisWorkbook. Ive been using the same excel spreadsheet ( which contains quite a bit of code) on 7 computers for years and all of a sudden I'm getting this error but only on 4 of the computers.. Any Ideas or Suggestions?


I have searched the forums and found similar posts to mine, but my question is still unanswered.
At my workplace we have spreadsheets which import sales figures from SQL.
A macro runs and adds an extra menu to the toolbar, which gives a button to update the figures.
On a particular machine (Windows 2000 pro/Office XP) when opening these spreadsheets, as soon as I click Enable macros, i get the following error:

compile error in hidden module: This workbook

Lots of people access these spreadsheets daily to check figures including myself and they work fine. It's just on this one machine.

Anyone got any ideas on what might be the problem here?

I am a desktop support technician, but i am only just starting out, and i especially dont know alot about excel.

Many Thanks in advance.

In my VBA Project window I am showing a ThisWorkbook and a ThisWorkbook1 Has anyome seen this before. I am use to seeing just one "ThisWorkBook". I am also getting an error message "compile error in hidden module: ThisWorkbook1" when I open the workbook. How do I get rid of ThisWorkbook1?


I have a spreadsheet file on opening, it gives an error message as "compile error in hidden module: Module1".

Can you please help in getting out of this error message.

Recently had to recover my system, WIN XP SP2. Reinstalled office 2007. When I run excel I get the message: Compile error in hidden module TBRun9 . After I click on the OK box, the program seems to work all right. Can someone tell what this means and how to fix it?


I have an excel database which links into Outlook and Word via macros to automate sending of e-mails and creating documents, etc. Obviously, I have created the correct VBA references and things have been working fine for a while.

However, this is a shared workbook over a small number of machines and due to a recent upgrade, one of the machines is running Vista and Office 2007, whereas the rest run Office 2000 and NT.

All works well until the workbook is opened and saved on the Office 2007 machine as this then changes all the references to Word 12, Outlook 12, etc, instead of Word 9 as seen in Office 2000. Then, when an office 2000 machine opens the workbook, it has a compile error as it cannot find the office 12 references!!

I have created some code to fix this, which uses the AddFromGuid method, which works ok, e.g.:

ThisWorkbook.VBProject.References.AddFromGuid _
    "{00062FFF-0000-0000-C000-000000000046}", 9, 3

What I want to do is as excel opens, check for missing references and fix them automatically, which is pretty simple on the face of it. However, as the macro fails due to a compile error all macros stop running, therefore whatever I put in the Open_Workbook event doesn't run.

Does anyone know how to either stop the compiler running on start up, or a way of error handling the compile error??

Hi Folks.

I'm trying to run a UserForm (any UserForm actually!) on a PC using Vista, with Office 2000. I'm continuously getting the error message 'Compile Error - Project or Library Not Found'. Having searched through some old threads, I've found myself looking at the 'Tools - References' pop-up, but am unsure as to what needs ticking. Furthermore, after several house moves, I can't find the Office installation disk - so couldn't update from the disk anyway.

Just ticking the boxes doesn't seem to work...(!!??)

I've run UserForms on this PC before, so something's changed...!!

Any help greatly appreciated.

Many thanks,


Whenever i open excel i get this message:
Microsoft Visual Basic
Compile error in hidden module: AutoExecNew

And i get this one whenever i close excel:
Microsoft Visual Basic
Compile error in hidden module: DistMon

I can still use the progam but it runs slow. any ideas on how to solve it?

Hi All!

Ok I've created a database of sorts with user login, userforms .. the whole 9. (with the help of this site) THANKs!!

However, depending on who tries to open the file they can get a message :

Compile errror in hidden module: sheet1
Compile error in hidden module: userform1

I am working with excel 2003 sp2

The people who get error messages are working with excel 2003 (no sp) & excel 2003 sp3.

I am working with excel 2003 sp2.. and do not get this message, others with lower version do not get it either.

Is there some download for this?

Thank you!!

After hours of work with a spreadsheet, my computer suddenly froze and I had to restart. When I tried to open the xls file again, I got the message right after seeing the spreadsheet:

"Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenicence."

Excel then tries to restart, but the same error/error message occurs, and this loop continues...

Any thing I can do to save the file?

All of a sudden I am getting an error on Excel startup. The error is a
Microsoft Visual Basic message...compile error in hidden

I have no idea why this is happening. It does not appear to have any effect
on anything I do in Excel.

Any ideas?


Whenever I startup Excel 2007, I get the following Microsoft Visual Basic error message:

Compile error in hidden module: AutoExecNew

The program will not start until you either click on OK or close the window.

Then when you close Excel, you get another Microsoft Visual Basic error message:

Compile error in hidden module: DistMon

This was not happening when I first installed the software, but now all of a sudden it is happening. It happens in Word and PowerPoint also.

Any ideas on how to correct would be appreciated.


When I try to open Excel 2007, I get an error message that says 'Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience'

Then I have the option to recover work and restart Microsoft Excel. I always have to leave this unchecked or else I just get the same error message every time it tries to restart excel.

So, to get around this, I have to find a preexisting excel sheet on my computer somewhere, open it, and then click file -> new spreadsheet in order to get a new spreadsheet. A simple solution, but I would prefer to solve the root of the problem. I tried reinstalling the whole office suite yesterday, but the problem persists.

Also, I do not have this problem with word, outlook, or powerpoint, only with excel.

Any suggestions?