Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Curtis_Waguespack
in reply to: Anonymous

Hi rtrayes13,

 

There were a couple of issues with the file path your last code sample:

  1. a backslash was needed between the folder path and the file name
  2. using the sheet name as the xls file name means that a colon is used in the file name, which is not permitted, so we have to remove or replace the colon, In the example below it's replaced with an underscore.

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oDoc As Inventor.DrawingDocument
oDoc = ThisDoc.Document
Dim oPartslist As PartsList
Dim oSheet As Inventor.Sheet

'get folder (using the same path as this doc)
folderName = ThisDoc.Path

'look at each sheet
For Each oSheet in oDoc.Sheets
'get the first parts list on the sheet
oPartslist = oSheet.PartsLists(1)
'replace colon in sheet name with underscore
oName = Replace(oSheet.Name, ":","_") 
'export each parts list
oPartslist.Export(folderName & "\" & oName  & ".xls", PartsListFileFormatEnum.kMicrosoftExcel)
Next 

'tell the user the files were created
MessageBox.Show("New *.xls files created in: " _
&vblf & folderName, "iLogic")

'open the folder where the new folders are saved
Shell("explorer.exe " & folderName & "\" ,vbNormalFocus)