"Compile error in hidden module" message [SOLVED]

  • I created a spreadsheet that works just fine on my machine, but when other users access it via our company web connection (inside the firewall), they get the "compile error" message listed above...but only the FIRST time!


    If they hit the "back" button on the browser, and try it again right away, the macro works fine and no error message appears.


    Later on, if they come back to open the exact same file again, the process repeats itself.


    Any ideas, anybody?

  • A quick Google search on "Compile error in hidden module" shows numerous possibilities.
    It seems that this message is usually followed by more text ie:
    "Compile error in hidden module: Initilization" or "Compile error in hidden module: AutoExec" etc...


    If you could give us the complete error message that would helpful.

  • If my memory is correct (it isn't always), I have run into this error with someone else's add-in. It first occurs when the add-in is loaded because a proceedure references something that I don't have on my machine. As long as what I'm doing doesn't then actually execute the procedure, I get no more error messages.


    Why is the module hidden for your users? Did you protect it? If so, you could unprotect it and then the user could presumably find the offending line of code. Or are you using a dll or other code library that they can't access?


    Just some thoughts.

  • The exact error message is


    "Compile error in hidden module: Loginform"


    "Loginform" is the very creative name that I have given to the module I use to get the name and password as part of the Workbook_Open procedure. :wink2:


    What's especially confusing to me is the fact that it works fine the second attempt every time!


    In response to Derk - the module is protected so that the users won't hack into it (easily, anyway) and reveal some modestly sensitive information. This is a sales report that goes to all sales reps, and the VBA code is designed to only reveal THEIR sales without letting them see the data on everyone else in the country.

  • Hi jrog0526


    I would guess you have a UserForm show on start-up to collect the users info? If so, comment out all code in the Initialize and Activate Event of the UserForm. Then put back one at a time.

  • Qik Fix.....


    Unprotect the problem file and then access it from one of the offending computers. The prompt will appear but because you have the code open it will allow you to debug it. This should take you directly to the root of the problem.


    AJW

  • Okay...I took AJW's advice and took the protection off. When I tried to get in, the compile error took me to the first line of code within the "OKButton Click" event:


    Private Sub OKButton_Click()
    'get data from input box
    mName = UserName.Text
    mPassword = Password.Text

    'store entered data to cells
    Worksheets("Hidden").Range("B2").Value = mName
    Worksheets("Hidden").Range("B3").Value = mPassword


    ...etc.


    The error took me to the line "mName = UserName.Text". I can't see any reason why there would be a problem there!


    Just to confirm, I backed up on the browser, and came back in via the hyperlink a second time...worked flawlessly!


    I am wondering if my "personal.xls" add-ins that reside on my computer may be causing this? Would a spreadsheet created on a computer with custom add-ins think it needed those add-ins later on even if they weren't referred to within the spreadsheet itself?

  • I think I have it figured out! I tested on a local machine and it seemed to have eliminated the problem. I will await the verdict from users in the field before I declare total victory.


    What I found is that my project had a folder that container a "reference" to FUNCRES.XLA since I use it on my machine all the time. However, that particular spreadsheet has no need for that add-in, and most users in the field haven't a clue what an add-in even is!


    I went to Tools/References and unchecked "Funcres" (and autosave), then reloaded the file to the website. As mentioned above, it seemed to work! :tumble:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!