Bug exceldeletesheet?

Bug exceldeletesheet?

abel_vanderwindt
Contributor Contributor
16 Views
2 Replies
Message 1 of 3

Bug exceldeletesheet?

abel_vanderwindt
Contributor
Contributor

[ FlexSim 21.0.4 ]

Hi,

I am trying to delete the content of Excel sheets I later want to fill with data. See the script window for the code. However, I get an error message that FlexSim is unable to delete Sheet1.

Is this a bug or am I using it the wrong way?

Regards,

Abel

exceldeletesheet.fsm

Test.xlsx

Accepted solutions (1)
17 Views
2 Replies
Replies (2)
Message 2 of 3

Ben_WilsonADSK
Community Manager
Community Manager
Accepted solution

Hi @Abel van der Windt,

Excel's interface is not displayed for user interaction, but you are using the optional 2nd parameter of exceldeletesheet() which requires the user to confirm the action. Because Excel's interface is not available, you can't confirm, and things freeze up. Here is what is going on in Windows Task Manager:

38489-1618370130962.png

Even though you can't see Excel, it is waiting for your input, and so nothing happens.

Try removing the optional 2nd parameter from your call to exceldeletesheet(), or try explicitly setting it to 0.

Also, I did see the same error you mentioned the first time I tried your code ("FlexSim is unable to delete Sheet1"). However, after dismissing the error, I started Excel via double-clicking the test.xlsx file. Then after closing Excel (and making sure there were no remaining Excel processes listed in Task Manager) then your code seems to work properly (minus the optional 2nd param discussed above), and I haven't been able to duplicate the problem since.

Let us know what you find.

Message 3 of 3

abel_vanderwindt
Contributor
Contributor

Thanks for the explanation!

0 Likes