View Full Version : Solved: Left -Right -Mid functions not available

02-24-2006, 02:28 PM
Hi folks,

strange thing...can't explain why it happens. In my code for an Excel application I use the built-in functions Left- and Right, like in: Msgbox Right("This is a test", 5) Which normaly reults in displaying a message box with "test". I so happens in all (new) files, except for the one I have been working on for quite some time. The machine I use in the office uses W2K and Office XP, at home I use WXP and Office 2000. This afternoon, in the office, the code ran wiithout a problem, but at home I get a message
Compile Error:
Can't find Project or Library
I have not a clue why this happens. I do not load any special add-ins, I tried it out on two other machines (W2K/Office 2000) with same resulthttp://vbaexpress.com/forum/images/smilies/banghead.gif .

Why doesn't it run in this file, and without problem in other (new) files http://vbaexpress.com/forum/images/smilies/102.gif ? If any of you have a clue, plse help me out.



02-24-2006, 02:31 PM
That means you have Option Explicit declared in the error producing machine but an undeclared variable being present...

Most likely anyway...

well, if it works one place, but not the other...

You need to check Tools>References in the VB window and see if any are prefixed with MISSING:

Uncheck that one and you should be okay..

02-24-2006, 02:38 PM

done! Unchecked some missing web components (do not need them anyway) and it runs now!

Thanks a million!


02-25-2006, 06:32 PM
As a matter of interest, I have often gotten an error when using functions from the VBA Strings library (left, right, mid, etc.), when the missing reference is completely unrelated. That was the case here again, I see. It's as if the Strings library is like the canary in a coal mine that tells you when there is a reference-related compile error elsewhere in the code.

02-25-2006, 06:43 PM
Thanks for that John. Another example of using older versions to develop to avoid potential missing references, as in the recent post at Mr.Excel regarding the mscal.ocx and related calendar references...