Part List Export Problem

Part List Export Problem

Lance127
Advocate Advocate
713 Views
2 Replies
Message 1 of 3

Part List Export Problem

Lance127
Advocate
Advocate

I got this routine off the In The Trenches blog and am trying to change it, some. For some reason when I export I can only get 4 columes to export. So what the heck am I missing here? The Part List I am using has all the colums I am trying to export on it.

'-------------Start Of ilogic ------------------------------------------------
'
get the path and name of the drawing file
path_and_name=ThisDoc.PathAndFileName(False)' without extension


'define oDoc
oDoc=ThisDoc.Document


'specify the drawing sheet
oSheet=oDoc.Sheets("Sheet:1")' sheet by name
'
oSheet = oDoc.Sheets(1) ' first sheet


' say there is a Partslist on the sheet.
oPartslist=oSheet.PartsLists(1)

' create a new NameValueMap object
oOptions=ThisApplication.TransientObjects.CreateNameValueMap


'specify an existing template file
'
to use For formatting colors, fonts, etc
oOptions.Value("Template")="C:\_Print Release\Print Release Template.xls"

'specify the columns to export
oOptions.Value("ExportedColumns")="PART NUMBER;DESCRIPTION;QTY;PROJECT; REVISION NUMBER"

'specify the start cell
oOptions.Value("StartingCell")="A26"

'specify the XLS tab name
'
here the file name is used
oOptions.Value("TableName")=ThisDoc.FileName(False)'without extension


'choose to include the parts list title row
'
in this example "Ye Old List of Parts" is written to the StartingCell
oOptions.Value("IncludeTitle")=False


'choose to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth")=False

'check for existing XLS file and delete it if found
IfDir(path_and_name&".xls")<>""Then
Kill(path_and_name&".xls")
Else
EndIf

' export the Partslist to Excel with options
oPartslist.Export(path_and_name&".xls", _
PartsListFileFormatEnum.kMicrosoftExcel, oOptions)


'-------------End of ilogic ------------------------------------------------

Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
0 Likes
Accepted solutions (1)
714 Views
2 Replies
Replies (2)
Message 2 of 3

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

At my side, I have a PartsList with 3 columns in default:

 

ITEM

PART NUMBER

QTY

 

Using your code, I received an error when exporting. It says the argument is wrong.

 

But after I added the columns from Edit PatsList>> Column Chooser

 

DESCRIPTION

PROJECT

REVISION NUMBER

 

It works well. So I think the option can work only if all the columns you want to export are avaible with the PatsList

 

In addition, there is one extra space before “REVISION NUMBER” in your original code.

 

 

 

 

0 Likes
Message 3 of 3

Lance127
Advocate
Advocate

Thanks. I had the Parts List right, I just can't type I guess.


Lance W.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
0 Likes