Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default can't do Find or Replace while Modeless form is shown

Show the form; schedule the first macro execution to run to poll the form

the macro that runs then, schedules the next time it should run, then polls
the form.

if polling the form could result in a decision to cease polling, then
move the scheduling until after you get the results of polling the form

Ontime is not preemptive and I believe the interval is minimum of one
second.

The advantage is that code stops executing after scheduling the next time to
run and this is more compatible with the essentially single thread paradigm
of Excel VBA. But the above limitations may make it not suitable for what
you are trying to do.


Much of this information was in the link I posted.



--
Regards,
Tom Ogilvy





"R Avery" wrote in message
...
The implementation you suggest is not clear to me. Where should I put
the application.Ontime command, to which function, and how will it solve
my purpose? I understand what you mean by saying that I should not poll
the form so often, but other than the Sleep command (which i don't think
is what i want), I don't know how to delay the polling time.
Application.OnTime would be able to delay polling time, but using it in
the Sub below is not intuitive to me.

What exactly do you mean? Thanks in advance!


Sub MySub

' -- set up code here.

With frmModeless
.Show vbModeless

Do
DoEvents
Loop While Not (.IsCanceled Or .IsDone)
End With

' -- more code here that depends on the form having been done or
' canceled
MsgBox "Done"
End Sub

Tom Ogilvy wrote:
Instead of using Doevents with a tight loop, use application.Ontime to

run
your macro at a more reasonable interval. If you must run it this

tightly,
then don't expect anything else to work.

http://www.cpearson.com/excel/ontime.htm



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert 29.08 hours (shown in decimal form) to time shown in "hh:m Nila in Florida Excel Worksheet Functions 1 September 14th 08 01:35 AM
Removing focus from a Modeless Form? Ian Chappel Excel Programming 2 May 1st 04 07:54 PM
Activating a modeless form R Avery Excel Programming 2 February 4th 04 06:41 PM
Modeless but waiting form Zdenek Moravec Excel Programming 7 January 14th 04 02:00 PM
Modeless form for user interaction Arne[_2_] Excel Programming 6 July 15th 03 02:22 PM


All times are GMT +1. The time now is 04:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"