VBA Communication with SW 2016

Hello

I have a VBA code that worked in SW2015 and since we switched to SW2016, the code bugs on:

Dim swApp As SldWorks.SldWorks

A priori, the code can no longer communicate with Solidworks. (the goal being to open SW files using an Excel macro)

I looked in the VBA's tools/references, it tells me that "SldWorks 2015 Type Library" is missing and I can't find the corresponding 2016 file.

FYI, when I launch SW, I get the following message:

"SW's database is missing.not all features will be available."

Do I need to reinstall SW or is there a way to debug the code?

Thank you for your help.

 

Hello

Is it a swb macro integrated into SolidWorks?

Hello PL,

the macro is an Excel file.

So we need to include the SolidWorks 2016 library references like this:

From VBA in Excel (ALT F11) > Tools menu > References (stop the macro if it's grayed out) and check SolidWorks 2016.

 

1 Like

I had already checked all the references to SW2016.


ref.gif

What about restarting Excel and SolidWorks?

I've been trying to solve the bug for several days, I've restarted Excel and SW several times.

Is it possible to write "Dim swApp As SldWorks.SldWorks" another way for SW2016?

Hello

Was the macro created with a 32-bit windows and is the test done under 64bits?

There are some bugs for 64bit programming.

I don't have the 2016 version but a priori, no there is no new thing for the SolidWorks declaration...

What is the version of Excel? Is it 32-bit or 64-bit?

Is it the same version as before or has it changed too?

1 Like

Hello

Everything was done under Windows 64bits.

I may try a reinstall of SW2016.

Thank you for your help, I will come back to the forum to inform you of the result.

Before you reinstall: If you save a macro in SolidWorks, does it work?