Pause and Resume Macro
I've coded a excel macro which feeds data from different columns and same row to a website. Once all the data is put in website's fields, there is a submit button which needs to be clicked. This same process has to happen for each row. Loop is there but the requirement is to click the
manually not with codes.
Since macro loops for all the rows, how can I pause it and let the user click on submit button and when post submitting webpage is ready, resume the loop again. Please help me....
I have two suggestions for you.
(1) invoking a MsgBox will pause the code.
User can be prompt to click Ok on the MsgBox for the code to continue to run, hence before click Ok, they can click submit on the website. When the website is ready for user input again, then Ok button can be click. Drawback is they have to do two clicking instead of one, and user need to know when to click it (not too early before website is ready). Anyway the good thing is deploying this is just peace of pancake.
(2) add an event listener
Generally like this
Dim ResumeEventListener as Boolean ResumeEventListener = False Do While Not ResumeEventListener ResumeEventListener = ...'<some code to set it to true when the website is ready> DoEvents Loop
Drawback... hmm... not easy but worth it :)