VBA function to activate a reference library

Hello, I don't know if it's possible but in doubt as I haven't found it I ask.

For the needs of a vba macro under solidworks I will save data on an Excel file, the thing is that other machines will have to use this code and to avoid crashing you have to make sure that the Excel reference library is activated. Isn't there a way to force activation at the beginning of the execution?

NB: I found an ISetReferences function but I don't know if it's and how to use it.

Thank you

Hello

To my knowledge, the reference libraries selected when creating the macro are selected on all PCs that use this macro since this information is embedded with the macro, but Excel must be installed on all the PCs in question otherwise it will not work, in your macro you may need to check if Excel is installed.

The problem you may encounter is that the version of Excel is different on PCs and there can therefore be a crash. I've never had to do it, since use on a homogeneous machine park, but to get around this problem it must be possible to go through Late Binding, see HERE and HERE.

Kind regards

 

1 Like

Great thanks for the answer, it will make my work easier.

Concerning Excel on PCs no worries I also have a homogeneous machine park (same company) with the same versions etc.