Macro Solidworks 2021 vs 2022

Hello

I just migrated from Solidworks 2021 to Solidworks 2022.

Since then my macros don't work anymore.
I have to modify a lot of things to make it work.

For example, having to declare the " i " as an integer to make loops For i = ...

Well, at the end of the day, I'll end up modifying my code, no problem.

On the other hand, some standard functions no longer work.
For example, the Mid() function is no longer recognized.

Another more critical point for me, it no longer recognizes the Windows environment variables→ Environ(" username ") which is very useful to get the session ID to point to the right directory under c:\user.

Do you have any idea how to solve my problem?

In the references, I have one that is missing " CATIA Composer 1.0 Type Library " and I can't find it.

Thanks in advance

Yann

Hello and welcome;

Migrating to a new version can sometimes cause some problems, but the ones you announce do not seem to me to be the result:

If you have to declare variables (which is recommended and encouraged) looked at instead you don't have the notion of " Option Explicit " lying around in your codes.

The CATIA reference is not part of the Solidworks installation but only of the CATIA installation. (so if CATIA is not installed...)

=> Check the installed components:
https://help.solidworks.com/2022/french/Installation/install_guide/c_prep_clients_admin_images.htm?verRedirect=1
image

=> Reinstall or repair the installation of Visual Basic for Applications and Visual C++ redistributables if necessary.

=> The first thing I would do is reference your libraries back to Solidworks 2022.

2 Likes

It's weird for the Catia reference because I never had CATIA installed.
I thought it was a remnant of Solidworks 2021 because both are Dasault software