Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Time Out a MsgBox

I have a file that runs a macro when it is open. This file may be opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the user to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to automatically
respond after a time delay to allow the macro to continue running the bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount of
time with no response from the user?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Time Out a MsgBox

Hi,

How about this instead which closes after 5 seconds or when OK is pressed

CreateObject("WScript.Shell").Popup "Some message", 5, "Your Title"
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the user to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to automatically
respond after a time delay to allow the macro to continue running the bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount of
time with no response from the user?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Time Out a MsgBox

Mike, unfortunately that method is very unreliable, it works for some but
not others.

One alternative is to make a similar looking userform, set to automatically
unload with a timer (from a previous post)

' userform code
Private mbShow As Boolean

Private Sub UserForm_Activate()
Dim t As Single
Dim ShowTime As Single

mbShow = True

ShowTime = 5
t = Timer

While (Timer < ShowTime + t) And mbShow
DoEvents
Wend

If mbShow Then
Unload Me
End If
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
mbShow = False
End Sub

Obviously include relavant buttons and appropriate code code to similate the
msgbox.

Regards,
Peter T


"Mike H" wrote in message
...
Hi,

How about this instead which closes after 5 seconds or when OK is pressed

CreateObject("WScript.Shell").Popup "Some message", 5, "Your Title"
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the user
to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to
automatically
respond after a time delay to allow the macro to continue running the
bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount of
time with no response from the user?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Time Out a MsgBox

Peter,

Thanks for that. I read it's unreliable elsewhere but have never been able
to replicate a fault despite trying different machines & 3 different versions
of Excel. Do you know or can you point me in the direction of when it may
fail?
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Peter T" wrote:

Mike, unfortunately that method is very unreliable, it works for some but
not others.

One alternative is to make a similar looking userform, set to automatically
unload with a timer (from a previous post)

' userform code
Private mbShow As Boolean

Private Sub UserForm_Activate()
Dim t As Single
Dim ShowTime As Single

mbShow = True

ShowTime = 5
t = Timer

While (Timer < ShowTime + t) And mbShow
DoEvents
Wend

If mbShow Then
Unload Me
End If
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
mbShow = False
End Sub

Obviously include relavant buttons and appropriate code code to similate the
msgbox.

Regards,
Peter T


"Mike H" wrote in message
...
Hi,

How about this instead which closes after 5 seconds or when OK is pressed

CreateObject("WScript.Shell").Popup "Some message", 5, "Your Title"
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the user
to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to
automatically
respond after a time delay to allow the macro to continue running the
bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount of
time with no response from the user?



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Time Out a MsgBox

Pretty sure it first came up in this thread, starting from where I came in -

http://groups.google.co.uk/group/mic...el.programming

The long and short of it was it might work for some but not others. No
obvious explanation, but not related to OS, XL version, WScript enabled,
etc. That was 5 years ago but FWIW it doesn't work in my current machine
either.

Regards,
Peter T


"Mike H" wrote in message
...
Peter,

Thanks for that. I read it's unreliable elsewhere but have never been able
to replicate a fault despite trying different machines & 3 different
versions
of Excel. Do you know or can you point me in the direction of when it may
fail?
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Peter T" wrote:

Mike, unfortunately that method is very unreliable, it works for some but
not others.

One alternative is to make a similar looking userform, set to
automatically
unload with a timer (from a previous post)

' userform code
Private mbShow As Boolean

Private Sub UserForm_Activate()
Dim t As Single
Dim ShowTime As Single

mbShow = True

ShowTime = 5
t = Timer

While (Timer < ShowTime + t) And mbShow
DoEvents
Wend

If mbShow Then
Unload Me
End If
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
mbShow = False
End Sub

Obviously include relavant buttons and appropriate code code to similate
the
msgbox.

Regards,
Peter T


"Mike H" wrote in message
...
Hi,

How about this instead which closes after 5 seconds or when OK is
pressed

CreateObject("WScript.Shell").Popup "Some message", 5, "Your Title"
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis
that
introduces the fewest assumptions while still sufficiently answering
the
question.


"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be
opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the
user
to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to
automatically
respond after a time delay to allow the macro to continue running the
bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount
of
time with no response from the user?



.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Time Out a MsgBox

Please also see responses to the same thread you posted yesterday. If those
(or these) thread responses aren't what you are looking for, you may have
better luck posting a followup response indicating what you tried and what
still isn't working, rather than reposting.

Best,
Keith

"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the user to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to automatically
respond after a time delay to allow the macro to continue running the bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount of
time with no response from the user?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Time Out a MsgBox

Well if people are reporting it's unreliable then I gues it's the userform
option from now on. Thanks for the link
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Peter T" wrote:

Pretty sure it first came up in this thread, starting from where I came in -

http://groups.google.co.uk/group/mic...el.programming

The long and short of it was it might work for some but not others. No
obvious explanation, but not related to OS, XL version, WScript enabled,
etc. That was 5 years ago but FWIW it doesn't work in my current machine
either.

Regards,
Peter T


"Mike H" wrote in message
...
Peter,

Thanks for that. I read it's unreliable elsewhere but have never been able
to replicate a fault despite trying different machines & 3 different
versions
of Excel. Do you know or can you point me in the direction of when it may
fail?
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Peter T" wrote:

Mike, unfortunately that method is very unreliable, it works for some but
not others.

One alternative is to make a similar looking userform, set to
automatically
unload with a timer (from a previous post)

' userform code
Private mbShow As Boolean

Private Sub UserForm_Activate()
Dim t As Single
Dim ShowTime As Single

mbShow = True

ShowTime = 5
t = Timer

While (Timer < ShowTime + t) And mbShow
DoEvents
Wend

If mbShow Then
Unload Me
End If
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
mbShow = False
End Sub

Obviously include relavant buttons and appropriate code code to similate
the
msgbox.

Regards,
Peter T


"Mike H" wrote in message
...
Hi,

How about this instead which closes after 5 seconds or when OK is
pressed

CreateObject("WScript.Shell").Popup "Some message", 5, "Your Title"
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis
that
introduces the fewest assumptions while still sufficiently answering
the
question.


"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be
opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the
user
to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to
automatically
respond after a time delay to allow the macro to continue running the
bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount
of
time with no response from the user?


.



.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Time Out a MsgBox

Thanks for the reply. Sorry about the double post. I couldn't find
yesterday's post so I thought it didn't go through and reposted.

"ker_01" wrote:

Please also see responses to the same thread you posted yesterday. If those
(or these) thread responses aren't what you are looking for, you may have
better luck posting a followup response indicating what you tried and what
still isn't working, rather than reposting.

Best,
Keith

"JT1977" wrote:

I have a file that runs a macro when it is open. This file may be opened
manually or automatically by a macro from another file.

If the file is opened manually I would like a MsgBox to prompt the user to
end the macro before it gets into the body of the code.

If the file is opened automatically I would like the MsgBox to automatically
respond after a time delay to allow the macro to continue running the bulk of
the code.

Is there anyway to force a response to a MsgBox after a preset amount of
time with no response from the user?

Reply
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
Time Delayed Response to MsgBox JT1977 Excel Programming 5 April 9th 10 11:54 PM
Format Msgbox - time HH:mm Hennie Neuhoff Excel Programming 2 October 30th 08 12:56 PM
MsgBox taking a long time to clear from screen [email protected] Excel Programming 2 September 20th 06 01:56 PM
MsgBox date & time skippy Excel Programming 7 April 22nd 05 08:19 PM
elapsed time in msgbox Rick[_19_] Excel Programming 8 January 6th 04 08:34 PM


All times are GMT +1. The time now is 05:53 AM.

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"