Chr$

S

Scott

I have the following line working on 2003, but not 2007.

crlf = Chr$(13) & Chr$(10)

It highlights "Chr$" and says, "Compile error: can't find project or
library." Then it pops up the "References - VBAProject".

Thanks for any help.
 
C

Chip Pearson

If you have a reference that cannot be found, you'll often get
compiler errors on functions whose modules can be found. It seems the
compiler gets a bit confused when resolving references if any
reference is missing. In VBA, with your project open, go to the Tools
menu, choose References, and see if any reference is marked "MISSING".
If you find such a missing reference, you can (1) uncheck it and
ignore it, if your project doesn't need it, or (2) add in back if you
know the file name or the GUID of the reference, or (3) contact the
vendor for assistance in reinstalling the application responsible for
that reference.

You might try starting Excel with the /regserver switch. Close Excel,
and go to the Windows Start menu, choose Run, and enter the following,
including the quotes as shown:

"C:\Program Files\Microsoft Office\Office12\Excel.exe" /regserver

Of course, you may have to modify the folder specification to match
your installation. The /regserver switch tells Excel to start up and
rewrite all of its registry items back to "factory defaults". Once
you do this, close Excel and start it normally. The /regserver switch
can cure all manner of problems with Excel.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
 
S

Scott

Thanks a lot, Mr. Pearson.
A couple of references were marked "Missing". I unchecked them and added
back. The program is now working.

Chip Pearson said:
If you have a reference that cannot be found, you'll often get
compiler errors on functions whose modules can be found. It seems the
compiler gets a bit confused when resolving references if any
reference is missing. In VBA, with your project open, go to the Tools
menu, choose References, and see if any reference is marked "MISSING".
If you find such a missing reference, you can (1) uncheck it and
ignore it, if your project doesn't need it, or (2) add in back if you
know the file name or the GUID of the reference, or (3) contact the
vendor for assistance in reinstalling the application responsible for
that reference.

You might try starting Excel with the /regserver switch. Close Excel,
and go to the Windows Start menu, choose Run, and enter the following,
including the quotes as shown:

"C:\Program Files\Microsoft Office\Office12\Excel.exe" /regserver

Of course, you may have to modify the folder specification to match
your installation. The /regserver switch tells Excel to start up and
rewrite all of its registry items back to "factory defaults". Once
you do this, close Excel and start it normally. The /regserver switch
can cure all manner of problems with Excel.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



I have the following line working on 2003, but not 2007.

crlf = Chr$(13) & Chr$(10)

It highlights "Chr$" and says, "Compile error: can't find project or
library." Then it pops up the "References - VBAProject".

Thanks for any help.
.
 
R

Rick Rothstein

I see you have solved the problem you posted about, but I thought you might like to know that VB has lots and lots of predefined constants for use in code... one of them is vbCrLf which equates to a carriage return followed by a line feed (which is what you defined your crlf variable to be), so you can eliminate your crlf defined variable and just use the built-in vbCrLf one instead. You can see a lot (I'm not sure it is all of them) of the available constants by typing in "Visual Basic Constants" (with the quote marks) in the VB Editor's help field (at the right side of the menu bar) and hitting Enter, then select the first item in the list that appears... this will bring up a help page with more links on them... the one I just told you about is under the "Miscellaneous Constants" link along with some other related constants.
 

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