When using exceldeletesheet in FlexSim 7.7.2, if the sheet name specified does NOT exist in the open workbook, FlexSim will not throw an error. It will simply continue running, which is what we want. It has been working well. The idea is that we create a new sheet with excelcreatesheet for each iteration run of the simulation, essentially blowing away any old sheets (with exceldeletesheet) on the fly as the iterations continue.
However we just discovered when using the exceldeletesheet command in FlexSim 2016.2, it now throws an "Excel Write Error" popup that says, for example, "Unable to delete sheet West1" if West1 doesn't exist in the workbook. And then you have to click OK to continue - which is kind of a hassle if your model creates many new sheets as it runs. We are using exceldeletesheet as a way to progressively clean-up an existing spreadsheet in case it still has data in it, which was fine in 7.7.2 because FlexSim ignored the fact that the sheet it was trying to delete didn't exist, which worked fine for us.
Of course one solution is to simply comment-out exceldeletesheet and then make sure ahead of time that the target workbook is "clean", i.e., nothing in it but Sheet1.
However, is there a way in FlexSim 2016.2 to find out whether or not a particular sheet actually exists in a workbook? For example, a command like "excelsheetexists" which returns a 1 if it does, and a 0 if it doesn't. We did not find anything like that in the command reference.
If we had something like that, then we could test for a sheet's existence and only delete it if it's there, which in all, is a cleaner approach. Or better yet, maybe a 3rd (new) parameter on the exceldeletesheet command that lets you suppress the error and continue (like it does in 7.7.2 by default). There's already a 2nd parameter on exceldeletesheet that warns you that you're about to delete a sheet, but that's not quite what we need.
Thanks for any tips.