Timer and Display Problem

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

RHurlburt

Thread Starter
Joined
Oct 31, 2003
Messages
130
Using "Userform", I have created a display called "Patience". It has a picture and a few words about a macro running. I have the timer set for 10 seconds which is about the time the macros take to run. In order to display the complete userform (picture and all), I had to set the "ShowModal" to "True", otherwise it displayed a blank userform. The timer works well with the ShowModal set to "False", but with "ShowModal" set to "True" it won't start unless I click on "label1" (within the userform). Sometimes it will also just keep running so I have to stop it by pressing "esc", the debug then highlights "Wend" as my error.

With the "ShowModal" set to "False", I can press the macros for "Show", the userform appears in all it's glory, and I can press the macro button for "ShowEnd" and it disappears. All well and good. However, with the "ShowModay" set to "True", the macro button "ShowEnd" just beeps and will not work. I have to click on the label1 within the userform for it to away.

*****
Sub Ten_Seconds()
Patience.Show

S = Second(Time()) + 10
While Second(Time()) < S
Range("B7").Value = Time()
Wend

Patience.Hide
End Sub
******
Sub ShowEnd()
Patience.Hide
End Sub
********
Sub Show()
Patience.Show
End Sub
********

1) Is there a command I should use to end the timer other than "Wend"?
2) What do I need to start the timer automatically when the "ShowModal" is set to "True"?
3) With "ShowModal" set to "True", what do I need to do to activate the macro button for "ShowEnd" so I can hide the Userform "Patience"? These are strictly for additional "play" and test and will not be activated while the "Ten_Seconds" macro is running.
4) I have tried using "ShowEnd" and "Show" in the "Ten_Seconds" macro in lieu of "Patience.Show" and "Patience.Hide", but they don't seem to work. Should they? Have also tried "Call Show"

This is a very simple timer, shows the actual time, etc., in "B7" right now. Just need a little "fixin".

Thanks in advance.

Dick
 

RHurlburt

Thread Starter
Joined
Oct 31, 2003
Messages
130
Mr. Guru
Will Do

In the meantime, will keep working on the above as it has become a challenge.

I think that if I put the "ShowModal = True" or something equivalent in my Ten_Seconds code, then the other two macros will work since the "ShowModal" will be False when they run. The only thing that is puzzling right now is why the time won't start with "ShowModal" = True but does work with it at False.

When I find my answer, will post.

As always, thanks for the response.

The "Splash Screen" from j-walk may be all I need.
 
Joined
Aug 30, 2003
Messages
2,702
>> Mr. Guru

Cut that out, Dick ; you know full well that you've learnt more about code in the last c.4 weeks than I have in the last four years. :D ;)

Consequently I'm looking forward to seeing you providing some solutions for others. (y)

Best rgds,
Andy
 

RHurlburt

Thread Starter
Joined
Oct 31, 2003
Messages
130
I thought I posted a reply yesterday, but guess I forgot to press the button. Old age.

Thanks for the compliment, but still learning, thanks to your efforts I am getting there.

As for my code problems, I was able to solve 3) and basically 4) above by using the following:

Sub Show()
Patience.Show vbModeless
End Sub

Which gets rid of the Modal/True problem for that code. I still haven't got the timer to turn on in ShowModal=True. ( 1) and 2) relate to the problem).

And, will be watching for an area I can help in.

Thanks!

Dick
 
Joined
Aug 30, 2003
Messages
2,702
Sorry, took a while to find ½ an hour to look into this.

With Patience's ShowModal set to false ; in a plain module,

Sub Show()
Patience.Show
End Sub

In Patience's code module,

Private Sub UserForm_Activate()
Patience.Repaint
Range("B7") = Time
S = Second(Time()) + 10
While Second(Time()) < S
Range("B7").Value = Time()
Wend
Patience.Hide
End Sub

HTH,
Andy
 

RHurlburt

Thread Starter
Joined
Oct 31, 2003
Messages
130
Didn't even think of "Repaint" and working with the wrong modules. I now understand better the ShowModal function. The "vbModeless" was getting me part way, but not where I wanted to be.

Thanks.

Middle of day there, hope you have a good day. The pint's on me.

Dick

Works just fine with one exception. It still doesn't end at the 10 seconds every time and I have to press "esc". Once I press the "reset" it works for a few more times. On "debug" it still points to the "Wend".



At any rate.
 
Joined
Aug 30, 2003
Messages
2,702
>> The pint's on me.

I think you may need to throw in some code to disable Patience's close button, which should be easy to find on Google. However, in general terms that's excellent news, since I only drink JD or Russian vodka. :D

Rgds,
Andy
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top