- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Export certain parts on template excel
Hello,
I tried to do it myself but not succeed...
I want to export on an excel template all the parts from all the subassemblies which has the iProperties
Left(iProperties.Value("Project", "Description"),13)
And the list must beguine from Row 6, there are another info on the top of the sheet.
If there can be also the thumbnail that will be a +
Many thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @CGVJM6DF
Can you attach the code you have worked on as it might just need some review. Where did you have trouble in making it work?
Can you explain currently how you are doing this process manually? Can you share the screenshots of the process?
If you only want to target the subassembly parts then you can open the subassembly exclusively and export the bom from there.
Or if this helped you, please, click (like)
Regards
Alan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
thanks @A.Acheson
This is my code I work on, but only the first part it is working, til " 'Start listing parts from line6"
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oTemplate As String oTemplate = "C:\Users\Cgv\OneDrive - KILDE A S Automation\Skrivebord\Packing List.xlsx" Dim oPartTitle As String oPartTitle = oDoc.ComponentDefinition.Document.PropertySets("Inventor Summary Information")("Title").Value Dim oPartNumProperty As String oPartNumProperty = ThisDoc.FileName(False) Dim oPartRevNum As String oPartRevNum = oDoc.ComponentDefinition.Document.PropertySets("Inventor Summary Information")("Revision Number").Value Dim oData As String oData = DateString Dim oWSHnet As Object Dim oUserName As String oWSHnet = CreateObject("WScript.Network") oUserName = oWSHnet.UserName Dim xlApp As Object Dim xlwb As Object Dim xlws As Object xlApp = CreateObject("Excel.Application") xlwb = xlApp.Workbooks.Open(oTemplate) xlws = xlwb.Worksheets(1) xlApp.Visible = True xlws.Cells(1, 3) = oPartNumProperty xlws.Cells(3, 5) = "Created: " & oData xlws.Cells(3, 3) = "List created by: " & oUserName xlws.name = oPartNumProperty ' Start listing parts from line 6 Dim currentRow As Integer currentRow = 6 ' Get the BOM structure Dim oBOM As BOM oBOM = oDoc.ComponentDefinition.BOM ' Iterate through the BOM rows For Each oBOMRow As BOMRow In oBOM.BOMRows ' Check if the part description matches your condition Dim partDescription As String partDescription = oBOMRow.ComponentDefinitions(1).Document.PropertySets("Inventor Summary Information")("Description").Value ' Check if the description starts with "Bosch Profile" If partDescription.Length >= 13 AndAlso partDescription.Substring(0, 13) = "Bosch Profile" Then ' Export the part information to Excel xlws.Cells(currentRow, 1) = oBOMRow.ItemNumber xlws.Cells(currentRow, 2) = partDescription ' Add more columns as needed currentRow = currentRow + 1 ' Move to the next row End If Next ' Save and close the Excel workbook xlwb.Save xlwb.Close
We do not do it manualy, it is some thing we want to do.
Actualy the plan it is to do a "Paching list". A list whit all the bosch profile placed in the project, so we can order them all in one time, and as many are neded. Right now we have a problem whit that.
We would like it to be an excel sheet, on which there is more information about the project at the top. the name of the project, the name of the person who made the list, After the order arrives, the name of the person who took the order and the name of the person who will assemble the parts will be filled in by hand... (This is what I managed to do with this code)
Many thanks....