By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,809 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

how to allow control to a form when VB code is running

P: 8
hi
I have written a program to search in the Excel Sheet but when the Search is in progress neither i am able to minimize the form nor click on other buttons that i have provided to stop the search in the middle. please help me as to how can i achieve this

Thanks
Apr 12 '07 #1
Share this Question
Share on Google+
3 Replies


Dököll
Expert 100+
P: 2,364
hi
I have written a program to search in the Excel Sheet but when the Search is in progress neither i am able to minimize the form nor click on other buttons that i have provided to stop the search in the middle. please help me as to how can i achieve this

Thanks
Hey there, kalichakradhar!

Do you eventually get the data you need?

Dököll
Apr 13 '07 #2

P: 8
Setting the public property KeyPreview = True returns the control to the form.
Apr 13 '07 #3

Expert 5K+
P: 8,434
hi
I have written a program to search in the Excel Sheet but when the Search is in progress neither i am able to minimize the form nor click on other buttons that i have provided to stop the search in the middle. please help me as to how can i achieve this
I believe there are two possible scenarios here:
  1. If your code is issuing a search command to Excel, then is stuck waiting until control returns, I think there's little you can do.
  2. If your code is doing the work itself while you sit and wait, then try putting some DoEvents statements in there. It doesn't matter where, as long as they are executed fairly frequently while your code searches. DoEvents (in pre .Net versions of VB, and I think in VBA) allows Windows to catch its breath and take care of other things like interacting with the user.
Apr 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.