AnsweredAssumed Answered

How to use RunMacro?

Question asked by Yong Ning on Jul 10, 2017
Latest reply on Jul 10, 2017 by Ivana Kolin

Help me. how to use RunMacro in Excel VBA

 

Result is  see image.

 

aa.jpg

 

 

SwApp.RunMacro FilePath, "a.swp", "aaa" , don't sub aaaa

************************************************************************

in excel vba  code is

Private Sub aaa()

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

       Set SwApp = GetObject(, "SldWorks.Application")

       Set SwModel = SwApp.ActiveDoc

    

   Dim FilePath

       FilePath = ThisWorkbook.Path & "\" & "a.swp"

       Debug.Print FilePath

       'SwApp.RunMacro FilePath, "a.swp", "aaa"

       SwApp.RunMacro FilePath, "a1", "aaa"

    

End Sub

 

 

in solidworks API

 

 

 

Private Sub aaa()

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

       Set SwApp = Application.SldWorks

       Set SwModel = SwApp.ActiveDoc

   Dim SwSelMgr As SelectionMgr

       Set SwSelMgr = SwModel.SelectionManager

   Dim SwDispDim As DisplayDimension, SwDim As Dimension

       Set SwDim = SwModel.Parameter("D1@Sketch1")

       Debug.Print SwDim.FullName

       MsgBox SwDim.FullName & "=" & SwDim.Value

       Stop

End Sub

 

 

 

2017 SOLIDWORKS API Help - Microsoft Visual Studio Tools for Applications Requires Microsoft .NET Framework 3.5  http://help.solidworks.com/2017/English/api/sldworksapiprogguide/GettingStarted/VSTA_Dependency_on_DotNet_3Dot5.htm

Attachments

Outcomes