Macro Filling Material

Hello

As part of the realization of a macro checking the custom properties of the components of an assembly, I am trying to open the materials dialog through this macro.

Having scoured the internet for a few days in search of a solution, and not having found an answer, I am posting this question:

Which VBA code to open this window or which method to use?

Thank you in advance for your answers or advice.

Hello, I think it is impossible to open this window with a macro.

Thanks to a macro, you can display a pop up where there would be a list for example to choose the material, or directly assign a defined material.

 

What exactly is the goal?

The purpose of  this macro is to check the set of properties of all components in an assembly.

I can check by macro if the material property is filled, but in case it is empty, I try to open this "dialog box" or "other" so that the user can choose his material in the SW material base.

It is a priori impossible to open this window with a macro, you will have to go through a list of choices.

The macro below allows this:

https://forum.solidworks.com/servlet/JiveServlet/download/372721-99849/GetMaterialFavorites.swp.zip

 

At the time for me, you can open the dialog box with this macro:

Sub main()

Dim swApp As SldWorks.SldWorks

Set swApp = Application.SldWorks

swApp.RunCommand 501, " "

End Sub

Flawless...

It works

 

Thank you.

1 Like