<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iLogic BOM Export Column Order in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/6026810#M116685</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the same issue with Inventor Professional 2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you would do the export manually from the BOM window, it will export it in the right order. But when exporting with the VBA Macro it will change the columns order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any information Autodesk could share with us?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Horacio&lt;/P&gt;</description>
    <pubDate>Fri, 05 Feb 2016 21:42:40 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-02-05T21:42:40Z</dc:date>
    <item>
      <title>iLogic BOM Export Column Order</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/5729339#M116684</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to use ImportBOMCustomization to prepare the assembly&amp;nbsp;BOM for automatic export.&amp;nbsp; What I need is a certain collection of columns in a certain order in Excel format.&amp;nbsp; But when I export the BOM through iLogic, the resulting .xls has the correct collection of properties but for some reason it reorders the columns alphabetically; i.e., the first column heading based on alphabetical order shows up in column A.&amp;nbsp; So for example my column headings from left to right have been reordered to "Description, File Path, Item, Part Number, Unit Quantity", which does not correspond to the order in my custom .xml.&amp;nbsp; I do not get this reordering when I import the customization .xml and export the BOM manually through Inventor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there some setting I am unaware of to prevent this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any input.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2015 17:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/5729339#M116684</guid>
      <dc:creator>danmorick</dc:creator>
      <dc:date>2015-07-20T17:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic BOM Export Column Order</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/6026810#M116685</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the same issue with Inventor Professional 2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you would do the export manually from the BOM window, it will export it in the right order. But when exporting with the VBA Macro it will change the columns order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any information Autodesk could share with us?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Horacio&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 21:42:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/6026810#M116685</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-05T21:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic BOM Export Column Order</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/6959814#M116686</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to achieve the same also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have already set up my BOM in the column sequence I want and when I export manually through the application window, it exports out perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However when using an iLogic driven rule to export the BOM, the columns in the output file are automatically placed in alphabetical order.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please refer us to a solution on the forum if it has already been solved as I cant seem to find it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Ash&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2017 22:04:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/6959814#M116686</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-20T22:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic BOM Export Column Order</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/7091741#M116687</link>
      <description>&lt;P&gt;Hi there everybody.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It seems this issue is common to all of us.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I found out the same issue in Inventor 2015 when exporting from a top level assembly. If I do from a normal assembly with no subassemblies, export goes fine, exactly as inventor would do by hand, but if done from the main assembly, with subassemblies, I have got the same issue you mention.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No patch up to today it seems, so no other workaround than updating to a newer version?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly yours,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jorge Hevia&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2017 04:20:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/7091741#M116687</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-05-18T04:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic BOM Export Column Order</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/7093591#M116688</link>
      <description>&lt;P&gt;Hi. Please see this other thread with a viable solution posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-customization/thisbom-export-column-order-problem/m-p/4902030/highlight/true#M49080" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/thisbom-export-column-order-problem/m-p/4902030/highlight/true#M49080&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AddReference "Microsoft.Office.Interop.Excel" 'To use excel

Imports System.Windows.Forms
Imports System.IO
Imports Microsoft.Office.Interop.Excel        'To use excel

Sub Main()
	Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
	
	'Dim oPath As String
	'oPath = oFolderDlg
	'oFileName = oPath &amp;amp; "Bruce.xml"
	
	ExportBOM(oDoc)
End Sub

Private BOMCustomizationFile As String = "C:\CustFile.xml"

Private excelApp As Microsoft.Office.Interop.Excel.Application
Private xlws As Worksheet

Sub ExportBOM(oDoc As Document)

'File Path Creation/Processing
	'Note, the following line will cause an error if the document is not saved.
	Dim oExportPath As String = System.IO.Path.GetDirectoryName(oDoc.FullFileName) &amp;amp; "\BOM\"
	Dim oExportName As String = oExportPath &amp;amp; System.IO.Path.GetFileNameWithoutExtension(oDoc.Fu&lt;WBR /&gt;llFileName) 'without extension'get BOM Target folder path
	
	If Not System.IO.Directory.Exists(oExportPath) Then: System.IO.Directory.CreateDirectory(oExportPath): End If

	If Dir(oExportName &amp;amp; ".xlsx") &amp;lt;&amp;gt; "" Then
		Kill (oExportName &amp;amp; ".xlsx")
	End If 

'Inventor BOM Processing
	Dim oBOM As BOM = oDoc.ComponentDefinition.BOM

	oBOM.ImportBOMCustomization(BOMCustomizationFile)
	oBOM.StructuredViewEnabled = True
	oBOM.StructuredViewFirstLevelOnly = False
	
	Dim oStructuredBOMView As BOMView
	oStructuredBOMView = oBOM.BOMViews.Item("Structured")
	oStructuredBOMView.Export (oExportName &amp;amp; ".xlsx", kMicrosoftExcelFormat)
	
'Excel processing
	excelApp = CreateObject("Excel.Application")
	excelApp.Visible = True
	excelApp.DisplayAlerts = False
	
	wb = excelApp.Workbooks.Open(oExportName &amp;amp; ".xlsx")
	xlws = wb.Worksheets(1)
	
	Call ReorderXLBOM()
	
	excelApp.Columns.AutoFit
	excelApp = Nothing

End Sub

Private Sub ReorderXLBOM()
    Dim ndx As Integer
    Dim Found As Range
    Dim counter As Integer = 1
	
	Dim arrColOrder() As String = {"Item", "QTY", "Part Number", "Description", "Stock Number"}
    'arrColOrder = Array("Item", "QTY", "Part Number", "Description", "Stock Number")

	On Error Resume Next

    For ndx = LBound(arrColOrder) To UBound(arrColOrder)

        'Set Found = xlws.Rows("1:1").Find(arrColOrder(ndx),, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
        Found = xlws.Rows("1:1").Find(arrColOrder(ndx), , -4163, 1, 2, 1, False)
    
        If Err.Number &amp;lt;&amp;gt; 0 Then
            MsgBox ("Error With Excel FIND function: " &amp;amp; Err.Number &amp;amp; " :: " &amp;amp; Err.Description &amp;amp; vbLf &amp;amp; vbLf &amp;amp; ndx)
            Err.Clear
        End If

        If Not Found Is Nothing Then
                If Found.Column &amp;lt;&amp;gt; counter Then
                        Found.EntireColumn.Cut
                        xlws.Columns(counter).Insert(-4161)
                        excelApp.CutCopyMode = False
                End If
                counter = counter + 1
        End If
    Next
    
    If Err.Number &amp;lt;&amp;gt; 0 Then
            MsgBox ("Reorder Columns Rule Error: " &amp;amp; Err.Number &amp;amp; " :: " &amp;amp; Err.Description &amp;amp; vbLf &amp;amp; vbLf &amp;amp; ndx)
            Err.Clear
    End If   
End Sub

Public Function oFolderDlg
    Dim dialog = New FolderBrowserDialog()
'    dialog.SelectedPath = Application.StartupPath
	dialog.ShowNewFolderButton = True
'	openFileDialog1.InitialDirectory 
    If DialogResult.OK = dialog.ShowDialog() Then
        oPath = dialog.SelectedPath
	Else
		MsgBox("No File Selected. Aborting Rule")
		oPath = ""
    End If
	Return oPath
End Function&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 May 2017 17:49:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-bom-export-column-order/m-p/7093591#M116688</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-05-18T17:49:47Z</dc:date>
    </item>
  </channel>
</rss>

