Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automatisch afsluiten msgbox

484 views
Skip to first unread message

Marcel

unread,
Jul 17, 2001, 4:49:57 AM7/17/01
to
Om tijdens het uitvoeren van een macro de gebruikers te
attenderen dat er gegevens zijn gewijzigd laat ik een
msgbox een melding maken. Nu wil ik echter dat de msgbox
automatisch na bijv. 3 sec. weer verdwijnt. Ik weet dat
dit mogelijk is, alleen ik krijg het niet voor elkaar.
Wanneer ik TIMER gebruik, blijft de msgbox 5 sec. staan
maar dan moet ik alsnog afsluiten met OK.

Bijvoorbaad dank.

Marcel.

Roland Greve

unread,
Jul 20, 2001, 9:50:19 AM7/20/01
to
Hallo Marcel,

Dit is de oplossing van John Walkenbach van 25 April 2001:

>Excel can access the Windows Scripting Host (Wscript), and display
another
>type of message box by using the Popup method of the Shell object. This

>alternative message box differs from the standard message box in two
ways:
>it can dismiss itself after a specified period of time, and it's
possible to
>display the message box with no buttons.
>
>The example below displays a message box. If the user does not dismiss
it
>within five seconds, it is dismissed automatically.
>
>Sub PopupDemo()
> Dim WshShell As IWshShell
> Dim Msg As String
> Set WshShell = CreateObject("Wscript.Shell")
> Msg = "This message will self-destruct in 5 seconds."
> Title = "A friendly reminder"
> WshShell.Popup Msg, 5, Title, 7 + vbInformation
> Set WshShell = Nothing
>End Sub
>
>The first Set statement creates the Shell object, and assigns it to the

>WshShell variable. The first argument for the Popup method respresents
the
>text to be displayed. The second argument specifies the number of
seconds to
>display the message box. The third argument is the title bar text. The
final
>argument specifies the buttons and icon to be displayed (it works just
like
>the buttons argument for the MsgBox function).
>
>If you decide to use this alternate message box, be aware that system
>adminstrators often disable the Windows Scripting Host because of the
threat
>of viruses. If the Windows Scripting Host is disabled, the code will
>generate an error.
>
>Another alternative is to use a UserForm that dismisses itself. You'll
find
>an example here:
>
>http://j-walk.com/ss/excel/tips/tip39.htm
>
>John Walkenbach
>For Excel tips, macros, & downloads...
>http://j-walk.com/ss


Groet,
Roland

0 new messages