Hi,
I tried Curtis Waguespack's iLogic: Export Parts List with Options, and it works great on Part Lists. I'd like to do the same thing on a custom table, but I don't know what needs to be changed.
Could someone help me out here?
Thanks.
Bob
Solved! Go to Solution.
Solved by danvang. Go to Solution.
Here's what I'm trying:
I need to replace the last line (export the Partslist to Excel with options), with code that applies to the Custom Table.
_____________________________________________________________
' based on Curtis Waguespack's Export Parts List with Options June 30, 2011
'
' 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(1) ' first sheet
' say there is a Table on the sheet
oCustomTable = oSheet.CustomTables(1)
' create a new NameValueMap object
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' specify the columns to export
oOptions.Value("ExportedColumns") = "ITEM;Total QTY;DESCRIPTION;# OF TAGS;PART No."
' specify the start cell
oOptions.Value("StartingCell") = "A1"
' specify the XLS tab name
' here the file name is used
oOptions.Value("TableName") = ThisDoc.FileName(False) 'without extension
' choose whether to include the parts list title row
oOptions.Value("IncludeTitle") = True
' choose to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth") = True
' export the Partslist to Excel with options
oPartslist.Export(path_and_name & ".xls", _
PartsListFileFormatEnum.kMicrosoftExcel, oOptions)
_________________________________________________________________
Thanks in advance.
Bob
try this for your last line.
oCustomTable.Export(path_and_name & ".xls", FileFormatEnum.kMicrosoftExcelformat, oOptions)
@danvang wrote:try this for your last line.
oCustomTable.Export(path_and_name & ".xls", FileFormatEnum.kMicrosoftExcelformat, oOptions)
That worked! Thank you very much!
Bob