Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Message Box with a Timer

Is there a way to have a Message Box that displays a value and then
disappears after a time delay, say 2 seconds?

I would like to create a key-stroke macro which when I hit <ctrl-t for
example, the macro will run and display a result in a message box.

I'd then like the box to disappear after 2 seconds without the user having
to click on "Yes".

Thanks for the help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Message Box with a Timer

Here is some code for you. Note that you need to reference the project to
"Windows Script Host Object Model" (Tools - References -...)

Public Sub MessageTest()
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long

Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Click Me", secondstowait:=2, _
Title:="Hello, World", Type:=vbOKOnly)

End Sub
--
HTH...

Jim Thomlinson


"tom" wrote:

Is there a way to have a Message Box that displays a value and then
disappears after a time delay, say 2 seconds?

I would like to create a key-stroke macro which when I hit <ctrl-t for
example, the macro will run and display a result in a message box.

I'd then like the box to disappear after 2 seconds without the user having
to click on "Yes".

Thanks for the help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Message Box with a Timer

Perhaps worth mentioning this method works for some but not for others. The
conclusion from a long discussion last July was if it works - fine - but
don't expect it to work if distributing.

There didn't appear to be anything in common in terms of OS, XL version or
WSHOM.OCX version in systems in which it worked / didn't work, which was
puzzling.

Regards,
Peter T

"Jim Thomlinson" wrote in message
...
Here is some code for you. Note that you need to reference the project to
"Windows Script Host Object Model" (Tools - References -...)

Public Sub MessageTest()
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long

Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Click Me", secondstowait:=2, _
Title:="Hello, World", Type:=vbOKOnly)

End Sub
--
HTH...

Jim Thomlinson


"tom" wrote:

Is there a way to have a Message Box that displays a value and then
disappears after a time delay, say 2 seconds?

I would like to create a key-stroke macro which when I hit <ctrl-t for
example, the macro will run and display a result in a message box.

I'd then like the box to disappear after 2 seconds without the user

having
to click on "Yes".

Thanks for the help.



  #4   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default Message Box with a Timer

Thanks for the lead and I understand that it might not always work.

I can't seem to find how to install the Windows Script Host Object Model.

There is not a "references" under my Tools menu bar.

"tom" wrote:

Is there a way to have a Message Box that displays a value and then
disappears after a time delay, say 2 seconds?

I would like to create a key-stroke macro which when I hit <ctrl-t for
example, the macro will run and display a result in a message box.

I'd then like the box to disappear after 2 seconds without the user having
to click on "Yes".

Thanks for the help.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Message Box with a Timer

There is not a "references" under my Tools menu bar.

It is on the Tools menu in VBA, not Excel. Choose References,
scroll down to "Windows Scripting Host Object Model" and check
it.


Dim ISH As IWshRuntimeLibrary.WshShell
Dim Res As VbMsgBoxResult
Set ISH = New IWshRuntimeLibrary.WshShell
Res = ISH.Popup(Text:="Hello", secondstowait:=3)
Debug.Print Res


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"tom" wrote in message
...
Thanks for the lead and I understand that it might not always
work.

I can't seem to find how to install the Windows Script Host
Object Model.

There is not a "references" under my Tools menu bar.

"tom" wrote:

Is there a way to have a Message Box that displays a value and
then
disappears after a time delay, say 2 seconds?

I would like to create a key-stroke macro which when I hit
<ctrl-t for
example, the macro will run and display a result in a message
box.

I'd then like the box to disappear after 2 seconds without the
user having
to click on "Yes".

Thanks for the help.



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
Timer Vijay Excel Worksheet Functions 1 April 6th 07 11:00 AM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
vba timer William Barnes[_2_] Excel Programming 2 August 16th 05 10:14 PM
timer nyn04[_7_] Excel Programming 1 September 23rd 04 12:04 PM
Timer TJ Excel Programming 1 July 9th 04 03:18 PM


All times are GMT +1. The time now is 10:18 PM.

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

About Us

"It's about Microsoft Excel"