Hello
I recently recorded a macro for importing excel files of displacement vs. time values. However, when i ran the macro after editing some of the values in the excel file to test the macro, nothing happened. I'm wondering if I'm missing some commands or a part of the code. The following excerpt is the entire macro i recorded:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim myModelView As Object
Set myModelView = Part.ActiveView
myModelView.FrameState = swWindowState_e.swWindowMaximized
boolstatus = Part.Extension.SelectByID2("RotaryMotor1", "SIMULATION_ELEMENT", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("LinearMotor1", "SIMULATION_ELEMENT", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("LinearMotor2", "SIMULATION_ELEMENT", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
End Sub
I'm not familiar with the Visual Basic language so i'm not sure what
boolstatus = Part.Extension.SelectByID2("LinearMotor1", "SIMULATION_ELEMENT", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
is doing, particularly what is meant by the zeroes, False and Nothing. In the end, I hope to automate the process of inputting tabulated values for the motors in solidworks motion study. I'd appreciate any help in improving the code, alternative solutions or even some commands that could help me. Thank you.