HowDoIComeUpWithAUniqueName50


I developed an application in VBA for office 2003. I tested and sent it to a client. Works fine on my machine but compiling or running it on their machine give the error "Cannot Find Library". It then highlights the function LCase$. I tried using LCase$ in the immediate window and it gives me the same error. I open the object browser (F2) and browse VBA. The String library shows as does LCase$ and LCase. I tried using a number of the functions in the string library (Left$, Right$, Mid$, etc.) and they all give me the same error. The client had installed Office 2007 so we moved over to another machine that had 2003. Same problem. Other functions and statements execute but none of the string functions. I've never seen the likes. Any ideas



Re: Cannot Find Library

Mercury Schroeppel


Have you checked Tools->References to see if another missing library is masking the problem

I would try removing the $ sign, since it is usually unecessary. Also try fully qualifying the method calls: VBA.LCase(), etc.







Re: Cannot Find Library

HowDoIComeUpWithAUniqueName50

Thank you very much for your reply.

I did check the references. It doesn't report ANY missing references at all. I have tried the function with and without the $ ($ only makes it run faster because it doesn't have to do a type conversion). Both LCase$ and LCase are listed in the object when I browse it. Again, it works fine on my development computer.

The versions of VBA.dll are slightly different. The Client's computers have a somewhat later version but you would think they would be backward compatible since this is a scripting language. (It's only semi-compiled at runtime or in the development environment.) If this were really the problem, many plugins like Adobe Acrobat wouldn't work because they install modules to the Normal.dot file and rely on VBA working pretty much the same in any environment.

So I'm baffled. Never had this problem with any other distros.






Re: Cannot Find Library

Andy Pope

Hi,

You could try re register of excel.

Change path to that of the office install for your pc.

"C:\program files\microsoft office\office\excel.exe" /regserver





Re: Cannot Find Library

HowDoIComeUpWithAUniqueName50

Thank you for your comments. I failed to mention that this application is running in Word.

Since this is on client computers, I don't have too much control over the environment. Strangely, other add-ins like Adobe Acrobat are running just fine. The VBA.dll is a slightly different version on each machine but that shouldn't matter. The fact that I'm getting the same error on two separate computers seems to indicate that there is something wrong with the code and object binding. Since the problem seems to be with VBA itself in two separate installations, I'm puzzled. I have confirmed that some of the language functions don't work by running them in the immediate window. For instance:

Debug.Print Left$("Hello World", 2)

results in a Cannot Find Library error. This is the case with several functions I tried that belong to that portion of the VBA library.

I did see a thread with something similar that indicated that the modules should all be exported to a dos text file then removed. After that, a reimport supposedly solves the problem. My only issue with this scenario is if I wanted to distribute this application to 100 users, that means I would have to do this on each of their computers. Sorry, but "that just don't seem right". That would mean that VBA applications can't really be developed and distibuted. My guess is that Microsoft would disagree with that.





Re: Cannot Find Library

Andy Pope

Have you been able to try Mercury Schroeppel's suggestion of explicitly referencing the VBA library.

Have you tested LCase in the immediate window of the troubled pc without your application being loaded





Re: Cannot Find Library

HowDoIComeUpWithAUniqueName50

I have tried just about everything I can think of. I'm more convinced now that there is a missing library or class that is not showing up in the references as missing. I have had this type of thing happen before in VB6 and it's almost always some problem with a reference or a bad dll.

Is it possible that a security setting is keeping a particular library from being available even though it's not missing





Re: Cannot Find Library

RedRoop

I've got exactly the same situation, but in Excel. Did you ever get a solution to this problem

Roop





Re: Cannot Find Library

HowDoIComeUpWithAUniqueName50

I eventually found a missing reference but can't remember what it was or how I found it. I started a new project from scratch and added references and tested them one at a time then checked the main project against the list of references in the new project. As I recall, I found a reference in the main project that was addressing a missing file. One of my drive letters had changed and the registration was bad. I had to unregister then re-register the dll.