Is it possible to change the target file in “Excel Workbook” through custom code?
I need to change it for all of my defined exports.
Hi Thomas,
If all of your exports are pointed at the same file you could also simply leave Excel Workbook value blank for all but the first export line. Then it will automatically use the value from the first line. Then if you ever need to change it again, you can simply change the path in the very first export to change them all.
You can use Lars's method to clear them all and then manually set the first export. - in the above case ExportLine1.
Table exports = getvarnode(model.find("Tools/ExcelAuto"), "exporttable"); for (int row = 1; row <= exports.numRows; row++) exports[row][1] = ""; //"C:\\MyNewFileLocation\\File.xlsx";
Answer by Lars Christian J2 ·
You can use
getvarnode(Model.find("Tools/ExcelAuto"), "exporttable").as(Table)[1][1]
to change the export target .xlsx file for the first export. Increment the table row for each export file.
I.e.
getvarnode(Model.find("Tools/ExcelAuto"), "exporttable").as(Table)[1][1] = "C:\\MyNewFileLocation\\File.xlsx";
Note that you need to use \\ in the file path, as a single \ will be deleted by the parser.
Answer by Thomas JR ·
Thank for the solutions. However I have found a workaround because the main original intention was somewhat ill-conditioned.
© 1993- FlexSim Software Products, Inc. All Rights Reserved.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.