Numerous Compile Errors

David2e

New Member
Joined
Sep 26, 2007
Messages
47
I'm getting errors like the one below throughout my code when it's run on just a couple of computers but no problem when on others with the same Excel versions.

Code:
Sub PrivateMsg()

If Range("Message") <> "" Then
Msg = MsgBox(Range("Message"), vbInformation, "Message")

Else
End If

End Sub

In the problem computer this has a "Compile Error: Can't find project or library".

If I add
Code:
dim Msg as integer
this then works but turns up another error (undeclared variable)

until it gets to a function and then the function turns up the same compile error - highlights LEFT, but not in yellow... just as selected with the Function highlighted yellow.

section where LEFT is selected on error
Code:
Do While True
            If Len(Code) = 0 Then c = "": Exit Do
            c = Left(Code, 1)
            Code = Right(Code, Len(Code) - 1)
            Select Case c
                Case " "
                Case "A" To "Z", "a" To "z"
                    ThisPartner = ThisPartner & c
                Case Else
                    Exit Do
            End Select
        Loop

Has anyone any clue what could possibly cause such a thing?

I have tried an old version of the workbook... and some of the code that hasn't changed and the variable wasn't declared but it works fine there just not in the new workbook although it's no different.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
did you add Option Explicit at the start? This will cause errors for variables not declared.
 
Upvote 0
I found the error, and why it was ok on one computer.

http://support.microsoft.com/kb/q160870/

There was a reference to a library which is only on this computer. Nothing is actually used from the library but the link to it was causing this error throughout.

Removed the link and saved it and now it's fine.
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,184
Members
448,554
Latest member
Gleisner2

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