A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

EXCEL 2002: How do I user/simulate a Timer event in Excel form



 
 
Thread Tools Display Modes
  #1  
Old August 24th, 2004, 03:38 AM
JohnF
external usenet poster
 
Posts: n/a
Default EXCEL 2002: How do I user/simulate a Timer event in Excel form

Hi Everyone


I have a very long import procedure that's executed from a menu option. I
would like to open an "Import" message form and animate a file flying from
one side of the form (one folder) to the other side (another folder) until
the import is completed. I can easily do it with other applications but find
very hard to do with Excel forms, for example when I use Microsoft Access, I
use a Timer event and move the file fractionally every few seconds to
simulate the movement. However, Excel forms do not appear to have Timer
events like Access or VB.


I tried to simulate a time event with Excel form but without success; can
anyone help?


I tried various methods with Excel but none worked. "Application.OnTime"
looks promising but it does not work for me. Below is one method I used to
test the procedure (while testing I just tried to show one image and hide
another). Rather then having " BlinkMover" procedure executing every second
as expected, the procedure acually executes only once (only when the calling
"OpenSession" procedure is finished; defeats the reason for using the
timer...)


Any help would be greatly appreciated.


Global variable

===========

Public fBlinkMover As Boolean 'used with OPSES form to indicate whether to
blink

Public dTime 'Used to set time when to fire BlinkMover Procedure


Procedures

=========

Public Sub OpenSession()


strFileToOpen = Application.GetOpenFilename("Workbook (*.xls), *.xls", ,
"Open your existing AIP session")


If strFileToOpen False Then


'BLINKING procedure start


'START Blinking

fBlinkMover = True 'Start BLINKING

OPSES.Show 'Opne OPSES form - this form only has two images at the moment
(imgPic1 and imgPic2

DoEvents

dTime = Now + TimeValue("00:00:01") 'Set time to one second from now

Application.OnTime dTime, "BlinkMover" 'Instruct the application to run
"BlinkMover" procedure one second from now


....Do other work here...


Workbooks.Open Filename:=strFileToOpen


Sheets("Original_data").Select


*Deleted code to make the procedure shorter for this email

*Etc, etc, etc...


'STOP Blinking

fBlinkMover = False 'Stop BLINKING - this will also stop BlinkMover
procedure calling itself

OPSES.Hide 'Hide OPSES form


'BLINKING procedure stop


Sheets("Results").Select


MsgBox ("AIP session has now been opened")


Else

'User did not open

End If




End Sub




Public Sub BlinkMover()

If fBlinkMover Then 'Only execute if fBlinkMover is set to TRUE

opses!imgPic1.Visible = Not opses!imgPic2.Visible 'Reverse visiblitiy
(Show/Hide)

opses!imgPic2.Visible = Not opses!imgPic1.Visible 'Reverse visiblitiy
(Show/Hide)

opses.Repaint

DoEvents

dTime = Now + TimeValue("00:00:01") 'Add another second to dTime

Application.OnTime dTime, "BlinkMover" 'Call BlinkMover procedure again in
one second

End If

End Sub




Thanks for your suggestions.


  #2  
Old August 24th, 2004, 05:56 AM
Biff
external usenet poster
 
Posts: n/a
Default

How about a progrss bar?

http://j-walk.com/ss/excel/tips/tip34.htm

Biff

-----Original Message-----
Hi Everyone


I have a very long import procedure that's executed from

a menu option. I
would like to open an "Import" message form and animate a

file flying from
one side of the form (one folder) to the other side

(another folder) until
the import is completed. I can easily do it with other

applications but find
very hard to do with Excel forms, for example when I use

Microsoft Access, I
use a Timer event and move the file fractionally every

few seconds to
simulate the movement. However, Excel forms do not appear

to have Timer
events like Access or VB.


I tried to simulate a time event with Excel form but

without success; can
anyone help?


I tried various methods with Excel but none

worked. "Application.OnTime"
looks promising but it does not work for me. Below is one

method I used to
test the procedure (while testing I just tried to show

one image and hide
another). Rather then having " BlinkMover" procedure

executing every second
as expected, the procedure acually executes only once

(only when the calling
"OpenSession" procedure is finished; defeats the reason

for using the
timer...)


Any help would be greatly appreciated.


Global variable

===========

Public fBlinkMover As Boolean 'used with OPSES form to

indicate whether to
blink

Public dTime 'Used to set time when to fire BlinkMover

Procedure


Procedures

=========

Public Sub OpenSession()


strFileToOpen = Application.GetOpenFilename("Workbook

(*.xls), *.xls", ,
"Open your existing AIP session")


If strFileToOpen False Then


'BLINKING procedure start


'START Blinking

fBlinkMover = True 'Start BLINKING

OPSES.Show 'Opne OPSES form - this form only has two

images at the moment
(imgPic1 and imgPic2

DoEvents

dTime = Now + TimeValue("00:00:01") 'Set time to one

second from now

Application.OnTime dTime, "BlinkMover" 'Instruct the

application to run
"BlinkMover" procedure one second from now


....Do other work here...


Workbooks.Open Filename:=strFileToOpen


Sheets("Original_data").Select


*Deleted code to make the procedure shorter for this email

*Etc, etc, etc...


'STOP Blinking

fBlinkMover = False 'Stop BLINKING - this will also stop

BlinkMover
procedure calling itself

OPSES.Hide 'Hide OPSES form


'BLINKING procedure stop


Sheets("Results").Select


MsgBox ("AIP session has now been opened")


Else

'User did not open

End If




End Sub




Public Sub BlinkMover()

If fBlinkMover Then 'Only execute if fBlinkMover is set

to TRUE

opses!imgPic1.Visible = Not opses!

imgPic2.Visible 'Reverse visiblitiy
(Show/Hide)

opses!imgPic2.Visible = Not opses!

imgPic1.Visible 'Reverse visiblitiy
(Show/Hide)

opses.Repaint

DoEvents

dTime = Now + TimeValue("00:00:01") 'Add another second

to dTime

Application.OnTime dTime, "BlinkMover" 'Call BlinkMover

procedure again in
one second

End If

End Sub




Thanks for your suggestions.


.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL 2002: How do I user/simulate a Timer event in Excel form JohnF Worksheet Functions 6 September 23rd, 2004 04:56 PM
Text to Number - Difference between Excel 2000 & 2002 claytorm General Discussion 8 August 23rd, 2004 10:53 PM
Excel 2000 vs 2002 Sheet protection & Validation cells Andre Croteau General Discussion 4 July 17th, 2004 03:31 PM
Form Doesn't Go To New Record Steve New Users 15 May 16th, 2004 04:33 PM
Excel 97 to Excel 2002 Dean Setting up and Configuration 4 October 17th, 2003 05:08 PM


All times are GMT +1. The time now is 03:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.