Excel macro - is it mandate to use save & close command in macro

Hi @Pablito / someone I use lot of execute macro activity in one project
i have lot of subroutines in only macro xlsm file

I wanted to know- is it mandate to use save & close command in all subroutines
What would happen if i use save and close command in all subroutines

Thanks

The execute macro activity is always in an Excel Applications Scope I believe. There is an autosave option within the scope activity. Is this what you are asking?

3 Likes

I usually get document recovery error in excel after execution of bot

which end up in throwing hresult error

Excel can often provide some issues when using the bot, in terms of releasing the excel resources after an activity is completed. So I would always put a KillProcess activity just before the scope and kill excel. This is just a way to be sure there are no conflicts before an excel file is opened and used.

ok so you mean to say

if i have 15 scope activities then i should have 15 kill process activity ?

FYI… i am using REframework and inside that i have kill process in init --will that not work ?

It is the workaround that has worked for me on many occasions.

Test it out in a limited scope and see if it resolves your issue. It has become almost standard practice for me now to kill excel processes before using the application scope activity.

sometimes before actual completion of execution of the previous macro next execute macro activity will be running and this will cause an issue multiple time, make sure you use complete instead of interactive in WaitforReady property.

then use kill after some 5 execute query.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.