Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic: Export custom table to Excel

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Greatwhitenorth
1496 Views, 3 Replies

iLogic: Export custom table to Excel

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

____________________________________________________
Product Design & Manufacturing Collection 2021 | Vault Professional 2021
Dell Precision 7670 | Intel i7-12850HX - 2100 Mhz - 64GB
nVIDIA RTX A3000 12GB | Windows 10/64 Pro
3 REPLIES 3
Message 2 of 4

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

____________________________________________________
Product Design & Manufacturing Collection 2021 | Vault Professional 2021
Dell Precision 7670 | Intel i7-12850HX - 2100 Mhz - 64GB
nVIDIA RTX A3000 12GB | Windows 10/64 Pro
Message 3 of 4
danvang
in reply to: Greatwhitenorth

try this for your last line.

 

oCustomTable.Export(path_and_name & ".xls", FileFormatEnum.kMicrosoftExcelformat, oOptions)

** If my reply resolves this issue, please choose "Accept as Solution" **
Dan Vang
Message 4 of 4
Greatwhitenorth
in reply to: danvang


@danvang wrote:

try this for your last line.

 

oCustomTable.Export(path_and_name & ".xls", FileFormatEnum.kMicrosoftExcelformat, oOptions)


That worked!  Thank you very much!

Bob

____________________________________________________
Product Design & Manufacturing Collection 2021 | Vault Professional 2021
Dell Precision 7670 | Intel i7-12850HX - 2100 Mhz - 64GB
nVIDIA RTX A3000 12GB | Windows 10/64 Pro

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report