02-15-2018
06:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-15-2018
06:40 AM
Unable to export the current BOM config
Hello,
I need to export a BOM to Excel, using a BOM XML template, but without modifying the BOM current structure.
So I use :
- save current BOM config in "BOM Tempo.xml"
- load existing BOM config
- ....
- load "BOM Tempo.xml"
The problem is the saved file "BOM Tempo.xml" does not match the current BOM config, it is always the same.
The code I use :
Sub test()
Set oAss = ThisApplication.ActiveDocument
Set oBOM = oAss.ComponentDefinition.BOM
'Define file name to export current BOM config
BOM_tempo = Environ("temp") & "\BOM_tempo.xml"
'if existing file, delete it
On Error Resume Next
Kill BOM_tempo
On Error GoTo 0
'Export active BOM config, in order to restore it
Call oBOM.ExportBOMCustomization(BOM_tempo)
'Load the custom BOM config file
oBOM.ImportBOMCustomization ("c:\temp\custom BOM.xml")
'...some code...
'Restore the original BOM config file
Call oBOM.ImportBOMCustomization(BOM_tempo)
End Sub
Normally I should have the same BOM config that I had at the beginning...