Issue with UCase, LCase, Format, Mid etc in VBA

The most known situation in office environment – it was working on my computer, it is not on other. This time appeared compile error Can’t find project or library, but showing me UCase issue with highlighted code line. How code could loose the library for the basic VBA function?

When I saw this error I thought Yea, lets check the References box and find the broken one, but when I saw highlighted UCase function I was confused.

This happened to me first time. I have never got such case before. I checked References to find broken library responsible for VBA functions. There was any, but I missed one thing. About that later.

So, as always, I started my research. And this is what I found.

Possible causes

This issue can be caused by:
– MISSING library for used code
– variable named like not working function
– subroutine named like not working function


Uncheck the MISSING library

As I wrote at the beginning there was not any missing for the highlighted code. So not that.

Change variable names from special names to different

I never use such words for variable names, which are special/used in VBA or already used names for subroutines/functions, because that behaviour can lead to this kind of situation. To be sure, I checked the code again and there was nothing like this.

And the last one, which solved the case.

Add VBA. before function name

I found this solution as an answer on Microsoft answers page. That was something new for me. I’ve never wrote those functions using VBA prefix. What this means is instead of:


Put VBA. before, like shown below.


Partial solution

And this solved my problem! Or I thought that this is the solution…

Why is that?

After UCase() issue the same error appeared on other VBA functions like LCase(), Mid(), Format() etc.

I thought to myself OK, understandable, all those functions using same library.

But after adding VBA. prefix to all that functions I discovered the real deal for this situation. That one I missed at the very beginning.

Real source of the problem

The main reason for the title issue was MISSING library for Microsoft PowerPoint objects, which I described in the previous article.

If I noticed that at the start I would not have any further issue with UCase and other VBA functions, like I had.

But on the bright side, thanks to that, I learn something new.

Tomasz Płociński

Author: Tomasz Płociński

I'm very advanced in VBA, Excel, also easily linking VBA with other Office applications (e.g. PowerPoint) and external applications (e.g. SAP). I take part also in RPA processes (WebQuery, DataCache, IBM Access Client Solutions) where I can also use my SQL basic skillset. I'm trying now to widen my knowledge into TypeScript/JavaScript direction.

Leave a Reply

Your email address will not be published. Required fields are marked *