I am using VBScript to code some automation on excel. I have a MsgBox()
within the code, and am looking for a way to close the pop-up window created by MsgBox()
automatically without human intervention. Program execution would continue from there.
Automatically close MsgBox in vbscript?
My comment has provided you tips to search and find out feasible answers. However to save your time, here is some insights.
This post shows how you may manupulate MSGBOX in VB.
Here is the best possible way anyone could think of in terms of VBA.
- Create a form
- Use it as a MSGBOX
- Add a timer
- Given an elapsed time (idle) close the form.
--
- Another method Reference. This uses a
Pop-Up
box as the MSGBOX.
Code:
Sub Test1()
Dim AckTime As Integer, InfoBox As Object
Set InfoBox = CreateObject("WScript.Shell")
AckTime = 3
Select Case InfoBox.Popup("Click OK or do nothing within 3 seconds.", _
AckTime, "This is your Message Box", 0)
Case 1, -1
Exit Sub
End Select
End Sub
any other way to close pop-up window generated by
MsgBox
? –
Headless @Tukai do check on the updated I made on the answer. It seems to be pretty well for you since you are working on VBScript. Try that and comment please. –
Strafe
yes i m trying,but meanwhile could you say what
0
does here ? –
Headless Here is the syntax. Please read on. –
Strafe
The pure VBScript solution is the .PopUp method.
+1, definitely ideal. I've used this before from VBA for the same reason. –
Pyroxene
@Ekkehard you are gr8 as usual!! –
Headless
@Ekkehard can I have some help here - #14088181? –
Headless
To make this answer stand alone and be more complete, please edit it to contain a brief example right here too. –
Woebegone
My comment has provided you tips to search and find out feasible answers. However to save your time, here is some insights.
This post shows how you may manupulate MSGBOX in VB.
Here is the best possible way anyone could think of in terms of VBA.
- Create a form
- Use it as a MSGBOX
- Add a timer
- Given an elapsed time (idle) close the form.
--
- Another method Reference. This uses a
Pop-Up
box as the MSGBOX.
Code:
Sub Test1()
Dim AckTime As Integer, InfoBox As Object
Set InfoBox = CreateObject("WScript.Shell")
AckTime = 3
Select Case InfoBox.Popup("Click OK or do nothing within 3 seconds.", _
AckTime, "This is your Message Box", 0)
Case 1, -1
Exit Sub
End Select
End Sub
any other way to close pop-up window generated by
MsgBox
? –
Headless @Tukai do check on the updated I made on the answer. It seems to be pretty well for you since you are working on VBScript. Try that and comment please. –
Strafe
yes i m trying,but meanwhile could you say what
0
does here ? –
Headless Here is the syntax. Please read on. –
Strafe
© 2022 - 2024 — McMap. All rights reserved.
MSGBOX timer which gets triggered after being idle....
– Strafe