Compile Error with Left(string) or Right(string)

Tallica

Registered User.
Local time
Today, 02:12
Joined
Jul 27, 2010
Messages
26
OK,

I have the following code

Dim joblen
Dim jobroot As String
Dim activeRoot As String
Dim lclRoot As String

joblen = Len(Me.Enhanced)
joblen = joblen - 11
activeRoot = Me.Enhanced
activeRoot = Left(activeRoot, joblen)

Sometimes when the code is executed I get the follwong error.

Compile Error:
Can't find project or library

I have had this happen at random over the years in VBA for losts of different apps on several OS's.

Anyone know what causes this or how to fix it?
 
Try VBA.Len(), VBA.Left() and VBA.Right()

Also check the order of your references.

What line does it actually highlight when you click debug?
 
The word "Left" is what gets highlighted.

I think I found the fix.

Option Explicit at teh top of the module.
 
Oh you mean an error that happens when you click COMPILE?
 

Users who are viewing this thread

Back
Top Bottom