04-16-2015
03:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-16-2015
03:39 PM
Hi rtrayes13,
There were a couple of issues with the file path your last code sample:
- a backslash was needed between the folder path and the file name
- 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)