|
-
May 4th, 2000, 12:18 AM
#1
Thread Starter
New Member
Hi,
I'm new here and desperately in need of help.
I am struggling with code to create a userform which has a Cancel button. I want this rather long task to be performed as long as the user does not click the Cancel button. Otherwise it should keep performing the tasks until the whole document has been covered.
I think the way to go about his is to create a Timer control on my form, which will keep performing the task, unless cancelled by the user.
The problem is that the Timer Control is not available in Microsoft Word 97 Visual Basic for Applications. How can I port Visual Basic's Timer Control into Microsoft Word 97. Please help.
Thanks in advance.
Shr
-
May 4th, 2000, 02:28 AM
#2
Frenzied Member
The Keyword here is DoEvents, DoEvents tells VB to go and check if it's got any new messages, ie if the mouse has been clicked, esc has been pressed, etc. Make sure thre's a DoEvents in any big loops. That should sort it.
Code:
For i = 1 To 10000
Debug.Print i
Next i
won't let the user hit cancel
Code:
For i = 1 To 10000
Debug.Print i
DoEvents
Next i
will
Hope this helps
-
May 4th, 2000, 07:10 PM
#3
Conquistador
you could alos use application.ontime
-
May 4th, 2000, 07:27 PM
#4
transcendental analytic
If youre performing an operation within a loop and want to cancel it by pressing a button:
The loop:
Code:
Do
.
.
DoEvents
Loop Until cancelled
The command button:
Code:
Private Sub Command1_Click()
cancelled = True
End Sub
Also a for next loop can be cancelled by exit for.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|