WScript.CreateObject

gcarpenter

Registered User.
Local time
Today, 07:56
Joined
Oct 21, 2013
Messages
68
I cannot get this code to run in access 2010. It shows no missing references, but errors that Object required. Thanks for any help provided.

Dim wshShell, btn
Set wshShell = WSCript.CreateObject("WScript.Shell")

btn = wshShell.PopUp("Filter data wil be removed.", 2, "Data Unfilter:", &H4 + &H20)

Select Case btn
' Yes button pressed.
Case 6
WSCript.Echo "Did you mean to remove the data filter?"
' No button pressed.
Case 7
WSCript.Echo "Data filter will not be removed."
' Timed out.
Case -1
WSCript.Echo "No response has been received."

End Select
 
I can change the code to this suggestion, but then it errors out on WScript.Echo and says object required. The runtime 424 error.
 
VBA code in Excel does not necessarily work in access. The link will not help me.
 
VBA code in Excel does not necessarily work in access.
I agree, Excel VBA has different methods to that of Access VBA. You have to understand is that VBA is the same, it is just the application that differs. You can implement almost every method across platforms !
The link will not help me.
No it will not help you if you are not interested in trying to understand what BlueIshDan meant; It is as simple as replacing WScript.Echo with MsgBox.

So at the end of the day it is not completely useless ! :rolleyes:
 
I replaced WScript.Echo with MsgBox and now the popup will not time out. Should that have made any difference?
 
Can you please post the updated code?

Scratch that ! What is that you are trying to do in the first place?
 
My users keep removing filter data, then screaming where is my data, it changed, this code will confirm the data filter removal with a popup. What I want is the popup timed in case they don't respond in a given time. The timing of the popup worked until I added MsgBox to replace WScript.Echo.
 

Users who are viewing this thread

Back
Top Bottom