Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2004, 03:58 PM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in Excel macro after going from NT to XP

I have an Excel file which contains macros. It works just fine on WIndows NT. When I try to bring it up on XP, I get the error: "Compile error. Can't find project or library". The VB editor is pointing to the CHR() function. If I comment out the line containing the CHR function, I get the same error on the LEFT() function. Basically Excel on XP does not recognize any of the VB built-in functions. Does anyone know why this might be.
Another very strange thing is that I have another Excel file with macros which uses the LEFT function and it works on XP. What's going on?

On a side note, I didn't write these macros, I've inherited them.

Thanks for you help
Ken Denny

 
Old March 26th, 2004, 04:04 PM
Authorized User
 
Join Date: Jun 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ken,

I've seen something like this before.

The error probably isn't on the CHR() or LEFT(). The actual problem is most likely a missing reference - VBA just bombs out on one of the first lines that it executes when this happens.

Go to Tools->References in the VBA editor, and look for a reference that has MISSING in its name.

From my experience, it is usually something simple that isn't installed on (in your case) the XP machine that had been installed on the NT machine.

Hope this helps,
Paul
 
Old March 26th, 2004, 04:16 PM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Curiouser and curiouser. References is grayed out in the tools menu. It's not grayed out when I bring up other xls files.

 
Old March 29th, 2004, 05:33 PM
Authorized User
 
Join Date: Jun 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is this a locked (protected) project?

If so, References will be disabled (grayed out) until you unlock the project with the project's password.
 
Old March 30th, 2004, 03:17 PM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

References are only disabled when I open it on an XP machine. I can open it with any NT machine and references are not disabled.

 
Old March 31st, 2004, 09:38 AM
Registered User
 
Join Date: Mar 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the very same problem apart from my OS is Windows 2k

 
Old March 31st, 2004, 10:55 AM
Registered User
 
Join Date: Mar 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,If you make sure to stop the VB editor before you go into tools, you should be able to access references.
:)


 
Old April 1st, 2004, 11:41 AM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks. I was able to access the references and see that I had one missing reference, XLODBC.XLA. I did a google search and found a site to download it from, but that still didn't help. I think Excel was looking in the wrong place for it. Anyway, I created a new spreadsheet with the XP version of Excel and copied and pasted everything from the old one, with no changes and now the new one works, and it doesn't need the XLODBC.XLA reference.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Excel XP and Excel 97 chiefouko Beginning VB 6 9 March 30th, 2007 03:32 AM
copyFromRecordset error Excel macro maaron SQL Server ASP 0 August 11th, 2006 08:44 AM
Excel 2000 vs Excel 2002 Macro Issue williadn Excel VBA 1 July 14th, 2005 09:09 AM
Problems Installing VB6 app developed in XP on NT chiefouko VB Databases Basics 16 November 10th, 2003 08:29 AM
Using Excel XP and Excel 97 chiefouko Excel VBA 3 August 27th, 2003 03:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.