I have written some macro in VBA. It has 2 buttons one is SUBMIT and another is CANCEL. When i click on SUBMIT then it calls access and populate the data in another excel file and takes around 20-30 minutes to populate/complete the process. What I want is on click on CANCEL it should stop the process.

Any help will be appreciated.

Re: Activate the current window 80 80

i guess when u say populate u mean ur running inside a loop and populate one by one.. so all u need to do is put DOevents in your code.. in side the loop so you could still cancel ur work..

Re: Activate the current window 80 80

By using DoEvents u can return control back to O/S after every loop,so that u can break the loop in between if required.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.