Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2005

Tip: Looking for answers? Try searching our database.

OnTime-problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bo Hansson - 07 Nov 2005 12:38 GMT
On a user form I have a stack of images that I would like to browse by
changing the ZOrder every 5th second.
I've tried to use the OnTime-function, but it seems like the function does
not execute as long as the form is visible.
What's wrong?

/BosseH
Helmut Weber - 07 Nov 2005 13:30 GMT
Hi Bo,

you have to show your userform in mode vbmodeless,
like this, which changes the caption "x" of a commandbutton
every two seconds:

Sub test()
UserForm2.Show vbModeless
Call Mytime
End Sub
'---
Sub Mytime()
With UserForm2.CommandButton1
  If .Caption = "x" Then
     .Caption = "y"
  Else
     .Caption = "x"
  End If
End With
Application.OnTime _
When:=Now + TimeValue("00:00:02"), _
   Name:="Mytest"
End Sub
'---
Sub Mytest()
Mytime
End Sub

HTH

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Helmut Weber - 07 Nov 2005 13:43 GMT
...

and of course you have to make sure
to end the ontime macro in some way...

Helmut Weber
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.