Microsoft Visual Basic Compile Error: Can't find project or library

I'm sure this question has been answered somewhere before but I could not find anything. We are upgrading to 64 bit and Windows 7. When I was testing the new system I tried running the macro we've had for years (created in 2001) and got the message: Compile Error Can't find project or library. The macro was last edited using VB 6. It is a very simple macro that adds some custom properties to our parts that are then added to the drawings.

Any suggestions would be helpful. Thanks!

SolidworksApi macros
Answers 8
JC
JC 2010-04-28 Best Answer

in VB goto tool/references...

Look at the list and find where it has MISSING and the re-link  write down the file name and remove it from the list the add an new reference and find the file it will be a .DLL or .TLB

CR
CR 2010-04-28

Sorry, I should have mentioned I went to tools/ref and there were no missing Library or projects. The suggestions I found with VB web sites appear to focus on access databases which I am not using. The macro is very simple: Create custom property names and add them to Part Properties.

SF
SF 2010-04-28

I have this problem every time that we get a new computer.  No libraries show as missing.  What works for me is to deselect the libraries in 'tools', 'references' for OLE automation and any SW type libraries, select OK, and then go back in and reselect them.  I have no idea why this works, but at least for me, it does.  BTW, this is only an issue on 64 bit systems and has existed since at least SW2006.

JC
JC 2010-04-28

record a new marco  and just click stop and now copy and past your code in the new marco and run it to see if it works

SF
SF 2010-04-28

Mark, unfortunally this issue is reproducible on x32 systems as well. I have run into it many times.

There are only a couple of threads where the same issue happens:

https://forum.solidworks.com/message/145423#145423
https://forum.solidworks.com/message/117479#117479

But I have also no idea why these libraries are not "MISSED" but should be rechecked again in order to run the macro.

________________________________________________________________

SolidWorks API Tips & Tricks: http://amcbridge.com/?q=SolidWorksApiBlog
SF
SF 2010-04-28

This is usually a missing reference problem.  Maybe some of your references are not supported on Windows 7 64 bit. Check http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx.

VB6 is fast losing compatibility with modern versions of windows.

CR
CR 2010-04-28

Thank-you everbody for all of the suggestions. Some of them I did not need today but may in the furture. I made a new macro by copying the old one and saving that macro. Thanks Jacob.

TR
TR 2011-01-03

I had the same problem as the OP; SW couldn't find the Mid function.  I noticed a SW2008 library was in the references dialog.  I unchecked the 2008 library, said OK. and got an error message.  But then it worked!