Compile Error: Can't find project or library

TFCJamieFay

Active Member
Joined
Oct 3, 2007
Messages
480
Hi All,

I have a workbook that is used by a number of different users accross the company. Some people have PC's running Windows 2003 SP3, some have terminals with either
- Windows 2000 SP4 with Excel 2002 SP3
or
- Windows 2003 SP2 with Excel 2002 SP3
on the server.

On the "Windows 2003 SP2 with Excel 2002 SP3" example the code below won't run. Saying "Compile Error in hidden module." I unlocked the code and re-ran the "Workbook_Open" event but I keep getting "Compile Error: Can't find project or library". I have then checked the references but none have the "Missing" prefix, so I don't know which to look for. Does anyone know what DLL i need to load or should I just get IT to updgrade to SP3?

Many thanks,

Jay

Code:
Private Sub Workbook_Open()

    Dim MyName As String
    
    'Sets the MyName variable to the users Username
    MyName = StrConv(Environ("username"), vbUpperCase)
    
    With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
    End With
    
    'Decides which reports to show each user
    Select Case MyName
    End Select

    Call PopulateReportList
    
    With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
    End With
    
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Jay

Which piece of code causes the error?

Have you tried using UCase instead of StrConv?

How exactly did you check the references?
 
Upvote 0
It's the MyName line that causes problems. It highlights "Environ". I'll try Ucase now.

Thanks Norie!

Jay
 
Upvote 0
No, Ucase didn't work either. I still get the same message and it highlights "Eviron" again.

Many thanks,

Jay
 
Upvote 0
Thanks for your reply Jonmo1. I've tried "Application.Username", but it errored out on "Strconv" so I changed that to "Ucase" and it gave me the same error message again highlighting "Ucase"!

Jay
 
Upvote 0
Are you absolutely sure that there are no MISSING references? That's pretty well always the cause of this problem. Also "hidden module" suggests that the VBAProject is protected.
 
Upvote 0
Gotta agree with Andrew. Especially when the error jumps around, you change one function, and the error jumps to another. That is caused by missing reference. Make sure you have the correct VBA Project Highlighted when you go to Tools - References. Also as Andrew said, you may have to UnProtect the project
 
Upvote 0
I know, I've had similar problems with other workbooks and checking the references window has pointed me in the right direction.

Thanks for your help guys!

Jay
 
Upvote 0
Jay

How are you checking the references?

When the code doesn't work?
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

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