5

I am going through some vba code and I get a compile error on UCase(). It says compile error: can't find project or library. I have never encountered this before, what library do I need to add through references to recognise this?

intrigued_66
  • 16,082
  • 51
  • 118
  • 189
  • possible duplicate of [vba code works in 2010 ad doesn't work in 2007](http://stackoverflow.com/questions/12110398/vba-code-works-in-2010-ad-doesnt-work-in-2007) – GSerg Dec 05 '12 at 09:19
  • Also see http://stackoverflow.com/q/11449858/11683. – GSerg Dec 05 '12 at 09:20

2 Answers2

10

Check the References dialog and you should find at least one reference marked "MISSING:" Remove that missing reference and all should be well.

Missing references can cause VBA to act strangely including not recognising built-in keywords

barrowc
  • 10,444
  • 1
  • 40
  • 53
  • 1
    As an example, this happened when we (as the developers) had the Rubberduck add-in added as a reference, but the user didn't have it installed. Before deploying we need to remove this reference to avoid the user having the `MISSING: Rubberduck AddIn #Rubberduck AddIn` reference. Adding the example as I didn't understand what was meant by this answer when I first read it a few weeks back. – Malan Kriel Jun 18 '22 at 08:47
1

I've also faced this same problem. But a kind of trick resolved the error:

Just replace lcase or ucase with vba.lcase or vba.ucase respectively.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Choudhary
  • 11
  • 2