Submitted by DHuskic on Thu, 03/27/2014 - 05:14
Forums:
Currently, I have a two step process.
1) Run journal to add attribute/value to each component in an assembly file
2) Export Assembly Navigator to spreadsheet, run vb macro in excel
Is there a way to combine these processes? Run/control the excel spreadsheet from within the journal? Any help will be greatly appreciated, have a wonderful day!
re: using Excel
If you have an author license, you can import the object model for MS office applications. This will make it easier to automate Excel.
The good news is: even if you don't have an author license, you can still automate Excel. It will just be a bit more difficult. There is some sample code in another thread that shows how to open Excel and write values. You can do much more than this in Excel, but that is as far as the example goes.
http://nxjournaling.com/?q=content/dimensions-drawing
Post back with specific questions, I'm confident that we can get something to work.
Excel Control Vs Data Table Efficiency
Before I get ahead of myself, any idea if it would be faster to:
Export the assembly navigator to a spreadsheet and control it by do some reorganizing with your method from above
Or
Read the attributes for each component into a Data Table and sort that accordingly, then print to a .csv file
DHuskic
Nx 9 VB
re: excel vs data table
Depends on your desired output. If all you want is a csv file, then the data table approach would probably be faster (simply due to the fact that your computer won't have to load up Excel). However, if you want an Excel sheet as output, then using Excel directly would have the advantage of letting you do formatting, enter formulas, and other exclusive Excel stuff.