Don't know if someone has had this issue, but I had a hard time figuring out this, so I decided to publish it.
I searched the forum and the web and din not find any solution, so I decided to post it here. It may help someone.
So, if you want to execute a Solidworks vba macro via Visual Basic .net here is the trick:
'This is a button
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
'Just to know if solidworks is already opened:
Dim opened As Boolean
If Process.GetProcessesByName("SLDWORKS").GetLength(0) > 0 Then
opened = True
opened = False
'Now, this will open solidworks if it is not already opened:
Dim app As SldWorks = CreateObject("sldworks.application")
If app IsNot Nothing Then
app.Visible = True
'And the way to execute the solidworks macro:
app.RunMacro("C:\Users\*******\Desktop\Macro1.swp", "Macro11", "Macro_name")
'The three string are:
'Macro filepath name
I'm like... 1 year later, but I'll ask it anyway!!!
I would like to lunch a macro from a Private Function. I have an events notify that works great, and from that, I would like to run my macro.
Althought, when I try using your formula, it tells my that "an = is expected"
I saw that you are in a Private sub while I'm in a Private Function, that may be the reason
Retrieving data ...