I'm trying to call my addin's commands in macro for testing automation.
I searched a lot but It's hard to get information about this issue.
Could you tell me whether it's possible or not?
Try the following approach.
Dim SwApp As SldWorks.SldWorks
Set SwApp = Application.SldWorks
Dim MyAddin As Object
Set MyAddin = SwApp.GetAddInObject("SwCSharpAddin1.SwAddin")
Try this method: 2015 SOLIDWORKS API Help - CallBack Method (ISldWorks)
Thank you for you answer.
I tried use CallBack Method but I couldn't make it.
What I did is below. My purpose is to call CreateCube Method in VBA (Macro).
I made addin using SW's c# addin template, build it to be COM-visible and registered assembly.
It works well with SW2015 and 2016.
But when i use the code below in my macro, 'rtn' returns always -1234 meaning failure.
Set swApp = _
rtn = swApp.CallBack("SwCSharpAddin1@CreateCube", -1234, "")
public class SwAddin : ISwAddin
public void CreateCube()
Thank you Artem Taturevych and Amen Allah Jlili !!!
Retrieving data ...