![]() |
Detect Macro Completion
Hi. I wanted to ask if there is a way to detect that a macro has completed (by
completing, an error stopping the macro also counts). I have a VB application that calls an Excel macro. The Excel macro makes a text file that the VB application needs to continue, so the VB has to wawit before continuing. In pseucode, i've done this waiting with a tight loop: call the macro While file_i'm_waiting_for doesn't exist Wend continue doing what i was doing The tight loop gets what I need done in good situations, but for example, if the macro experienced some kind of error that prevented it from completing making the text file, the VB app will sit in that tight loop forever and just hang. Isn't there some better way to detect that the macro is completed? Like some property I can check, e.g. using While WB.active = True instead of checking that the file exists. (I just made that "active" property up, but you know what I mean). Thanks. |
Detect Macro Completion
From what you've written here, I believe that you just need to set an
OnError condition in the macro, so that something actually happens when an error occurs. Stan Scott New York City "Minilek" wrote in message ... Hi. I wanted to ask if there is a way to detect that a macro has completed (by completing, an error stopping the macro also counts). I have a VB application that calls an Excel macro. The Excel macro makes a text file that the VB application needs to continue, so the VB has to wawit before continuing. In pseucode, i've done this waiting with a tight loop: call the macro While file_i'm_waiting_for doesn't exist Wend continue doing what i was doing The tight loop gets what I need done in good situations, but for example, if the macro experienced some kind of error that prevented it from completing making the text file, the VB app will sit in that tight loop forever and just hang. Isn't there some better way to detect that the macro is completed? Like some property I can check, e.g. using While WB.active = True instead of checking that the file exists. (I just made that "active" property up, but you know what I mean). Thanks. |
Detect Macro Completion
Put error handling in your file create macro and a completion status
variable which is set to false on the way in and true on the way out. The error handling can force the completion status to False and terminate the file creation. The compleion status is then used to control whether the next stage should run, and if required tell the user if an error occurs and control the ending of the process. Cheers Nigel "Minilek" wrote in message ... Hi. I wanted to ask if there is a way to detect that a macro has completed (by completing, an error stopping the macro also counts). I have a VB application that calls an Excel macro. The Excel macro makes a text file that the VB application needs to continue, so the VB has to wawit before continuing. In pseucode, i've done this waiting with a tight loop: call the macro While file_i'm_waiting_for doesn't exist Wend continue doing what i was doing The tight loop gets what I need done in good situations, but for example, if the macro experienced some kind of error that prevented it from completing making the text file, the VB app will sit in that tight loop forever and just hang. Isn't there some better way to detect that the macro is completed? Like some property I can check, e.g. using While WB.active = True instead of checking that the file exists. (I just made that "active" property up, but you know what I mean). Thanks. |
Detect Macro Completion
Make the macro a function and have it return it status. then your code will
wait for it and you can examine the results. results = Application.run( ... ) -- Regards, Tom Ogilvy "Minilek" wrote in message ... Hi. I wanted to ask if there is a way to detect that a macro has completed (by completing, an error stopping the macro also counts). I have a VB application that calls an Excel macro. The Excel macro makes a text file that the VB application needs to continue, so the VB has to wawit before continuing. In pseucode, i've done this waiting with a tight loop: call the macro While file_i'm_waiting_for doesn't exist Wend continue doing what i was doing The tight loop gets what I need done in good situations, but for example, if the macro experienced some kind of error that prevented it from completing making the text file, the VB app will sit in that tight loop forever and just hang. Isn't there some better way to detect that the macro is completed? Like some property I can check, e.g. using While WB.active = True instead of checking that the file exists. (I just made that "active" property up, but you know what I mean). Thanks. |
All times are GMT +1. The time now is 05:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com