Export an Assembly using ilogic to designated excel template tabs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi There,
Once again I need some help. So I been trying to export a BOM from an assembly. I found quiet a few very helpful codes, but I need some extra tweaks.
I am attaching a file that explains the final look if possible, of course. (item 3 is a plus, but I can work around it)
Requirements:
1) Thumbnails to be shown for all parts.
2) Export both the Parts only and the Structured all levels to different tabs in the same Excel sheet. (tabs name will be named based on the type of BOM
3) Use a preformatted excel template. (Now this will be ideal, but I can use Macros in excel to do the filtering and format as a table if not possible)
The code below exports the Parts only to the specified Excel sheet tab, but I haven't been able to send the Structured Bom to a different tab
4) Include Assembly part number and date time in exported excel file
'BOM Publisher oDoc = ThisDoc.ModelDocument If oDoc.DocumentType = kPartDocumentObject Then MessageBox.Show("You need to be in an Assembly to Export a BOM", "Databar: iLogic - BOM Publisher") Return End If oDoc = ThisApplication.ActiveDocument Dim oBOM As BOM oBOM = oDoc.ComponentDefinition.BOM 'Options.Value("Author") = iProperties.Value("Summary", "Author") '========================================================================================== 'You can change the output path by editing oPATH below oPATH = ("c:\temp\") 'If you change this, remember to keep a \ at the end '========================================================================================== 'STRUCTURED BoM =========================================================================== ' the structured view to 'all levels' 'oBOM.StructuredViewFirstLevelOnly = False ' '========================================================================================== 'PARTS ONLY BoM =========================================================================== ' Make sure that the parts only view Is enabled. oBOM.PartsOnlyViewEnabled = True Dim oPartsOnlyBOMView As BOMView oPartsOnlyBOMView = oBOM.BOMViews.Item("Parts Only") ' Export the BOM view to an Excel file 'oPartsOnlyBOMView.Export (oPATH + "BOM3.xls", kMicrosoftExcelFormat) oPartsOnlyBOMView.Export (oPATH + ThisDoc.FileName(False) + " BOM" + ".xls", kMicrosoftExcelFormat, "PARTS ONLY") '========================================================================================== i = MessageBox.Show("Preview the BOM?", "Databar: iLogic - BOM Publisher",MessageBoxButtons.YesNo) If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If If launchviewer = 1 Then ThisDoc.Launch(oPATH + ThisDoc.FileName(False) + " BOM" + ".xls")