Dtown266
Nuclear
- Oct 31, 2006
- 47
I am trying to write a macro that will allow me to Export only the selected dimensions to a table or database. Im new
to vba so much help would be greatly appreciated. Also I am using solidworks 2003.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
SldWorks 2003 Type Library (although it may be just SldWorks Type Library in SW2003)
SolidWorks Constant Type Library
Microsoft Excel 11.0 Object Library (again may be different for you, I have Office 2003 installed).
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDim As SldWorks.Dimension
Dim xlApp As Excel.Application
Dim xlWorksheet As Excel.Worksheet
Dim AtIndex As Long
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set xlApp = GetObject(, "excel.application")
Set xlWorksheet = xlApp.ActiveSheet
For AtIndex = 1 To swSelMgr.GetSelectedObjectCount
Set swDim = swSelMgr.GetSelectedObject5(AtIndex).GetDimension
xlWorksheet.Cells(1, AtIndex) = swDim.value
Next
End Sub