Solidworks C# Addin - Sending a string to a macro Solidworks C# Addin - Sending a string to a macro vba vba

Solidworks C# Addin - Sending a string to a macro


Solidworks supports 2 types of VB macro files

  • swp - newer version
  • swb - older plain text macro, here's an example of the empty swb macro :

    Dim swApp As Object  Dim swModel  As SldWorks.ModelDoc2    Sub main()      Set swApp = Application.SldWorks     Set swModel = swApp.ActiveDoc    End Sub  

If you have access to the source code of your macros you can convert them to plain text and leave in placeholders.

MsgBox "--MyParameter1--"

After user fills in parameters on your taskpane replace placeholders in the swb macro with actual values and run it.