Search

Tuesday September 07 , 2010
Font Size
   

SolidWorks Macros

Folder Path: \ SolidWorks Macros \

File: Export BOM

zip.png
Uploaded:
18.01.10
Modified:
20.01.10
File Size:
14 KB
Downloads:
128
Version
1.0

You have two methods for extracting BOMs to Excel. One is the in built function of SolidWorks, and the second is the manual way to creating exactly what you want in an Excel sheet.

The attached Macro does performs both.

Make sure you check that your References... are setup to your version of SolidWorks & Excel (Current example is SW2008 & Excel 2007):

You may use this macro however you wish, I only ask you leave the commented credits within the macro.

If you wish to save each BOM under the name of a value from the custom properties, such as $PRPSHEET:{Description}, you would modify the code to get the bomPath as follows:

Code:
Dim swApp               As SldWorks.SldWorks
Dim swModel             As SldWorks.ModelDoc2
Dim valOut              As String
Dim resolvedValOut      As String
Dim config As SldWorks.Configuration
Dim cpm As SldWorks.CustomPropertyManager

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc

Set cpm = swModel.Extension.CustomPropertyManager("")
If Not cpm Is Nothing Then
cpm.Get2 "description", valOut, resolvedValOut
End If


Now with resolvedValOut you may use that as the filename in any way you wish.