SolidWorks Macro VBA File Management

Hello

For 3 years now, it has been impossible for us to create Solidworks files from an Excel macro. This worked before we switched our PDM server to the 2020 version and still the same error in 2022.

When we use the copyfile, the SetVar (among others) in a macro we get an error (see image).

2023-04-05_11-29-19

It works if you use the macro on a text file for example but impossible on a sldprt or sldasm.

Does anyone have the same problem or a solution? :slight_smile:

Thanks in advance,

Loïc

Hello @lnieli

Loïc, happy to welcome you on the forum.

I hope we can help you solve a few problems.

We have our macro champion who will explain this to you in a few minutes

Kind regards

2 Likes

Hello
I had the problem with the programs I created (in C#) during our visit to Epdm 2022. I fixed this problem by targeting a different processor architecture when compiling the executable:
On 2019: x86/x64 - prefers 32-bit
On 2022: x86/x64 - prefers 64-bit
This change actually appeared from the 2020 version.
See HERE
Kind regards

3 Likes

Hello

Maybe another way because it's VBA, you should see your version of VB because I remember that the automatic installation after SW clears the VB7.DLL file (if I remember correctly) and replaces it with a lower version that can make macros unusable.
I use updatevar without problem on PDM 2022 with a 32-bit Excel.

1 Like

Hello
FYI, the only function that was causing me problems was "SetVar", all the other functions I use in my programs worked perfectly.
I can't say that it's the same problem because it's vba but it really looks like it, it's worth testing...
Kind regards

1 Like

Thank you both for your answers, it gave me some avenues to explore, unfortunately for the moment I haven't found a solution but I'll dig a little deeper.

Hello
Try to see this thread

Hello

To give you a little feedback, the element that was really problematic was the setvar.
After installing a 64-bit office, the problem is solved.

Thank you all for your answers.

A++