Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Chr$
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Chr$
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] On Thu, 4 Feb 2010 11:58:01 -0800, Scott wrote: 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Chr$
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" wrote: 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] On Thu, 4 Feb 2010 11:58:01 -0800, Scott wrote: 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. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Chr$
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.
-- Rick (MVP - Excel) "Scott" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|