Broken reference for chr function

B

Bill Murphy

I have all the normal references set like:

VBA
Excel 10.0 Object library
Windows common controls 6.0
VBA for applications extensibility 5.3
ActiveX data objects 2.8

When I compile my VBA code containing the chr function, which I thought was
very common, I get a "Can't find project or library" error message with chr
highlighted. Is there another reference I should set in my workbook to
prevent this?

Bill
 
R

Rob van Gelder

More than likely there is a broken reference.
Commonly occurs on a different PC to the developer due to some component not
installed.

From VBA | Tools | References, check for a reference which says Broken.

Suspect it is ActiveX Data Objects 2.8
 
B

Bill Murphy

Rob,

I checked my references, and none of them say broken or missing. Are there
any other references that you feel I need to get the chr function?

Bill
 
R

Rob van Gelder

In my experience, VBA functions which suddenly appear invalid are caused by
References being unavailable on the target PC.
Try unchecking each reference. Run again. Check the reference again. Run
again.

Chr is a function of the "Visual Basic for Applications" Reference.

Can you describe how this problem started? Are you running it on a PC
difference from your development PC?
 
B

Bill Murphy

Rob,

I had ignored a couple of seemingly unrelated references that were marked as
"Missing". I believe these were installed by the previous developer, and
were related to 3rd party products no longer in use by this workbook. After
I removed these two references chr worked properly, so this must have been
somehow impacting VBA.

This workbook was the only one that had a chr problem. Other existing
workbooks plus newly created ones worked ok.

Thanks for your help.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top