LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
cdb cdb is offline
external usenet poster
 
Posts: 62
Default Problem running code behind a userform

I have a workbook with an update button on (which has a macro behind it).
When I press this button I want a userform to open and display a flashing
message for the duration of the macro. I have tested all the bits seperately
and they all work fine - the update macro by itself works and updates the
data and the userform opens and display a flashing message if opened by
itself.

The problem I have is, if I put the userform into the update macro, once I
click the button the userform displays, but none of the code in the macro
works. I have tried adding the DoEvents code in but this doesn't seem to help.

Can anyone help me?

Code below:
------------------------------------------

Sub UpdateData()
DoEvents
UserForm1.Show
~ My Code
UserForm1.Hide
End Sub

------------------------------------------

Private Sub UserForm_Activate()
Label1.Visible = False
StartLoop:
If Label1.Visible = False Then Label1.Visible = True Else Label1.Visible =
False
RunPause
GoTo StartLoop
End Sub

------------------------------------------

Sub RunPause()
PauseTime = 0.75 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
End Sub

------------------------------------------

Private Sub UserForm_Terminate()
End
End Sub






 
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
Problem with Running VBA code on Cell Change Marty Excel Programming 8 January 18th 05 04:01 AM
UserForm-Code Problem Jim May Excel Programming 3 December 30th 04 04:28 PM
Running Total on Userform Richard Excel Programming 2 April 5th 04 02:12 PM
How can I use a worksheet while running a userform? Leo Excel Programming 4 December 17th 03 02:58 PM
Closing the Userform when macro is running SuperJas Excel Programming 5 December 10th 03 05:31 AM


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

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"