WScript.CreateObject (1 Viewer)

gcarpenter

Registered User.
Local time
Today, 13:43
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
 

BlueIshDan

☠
Local time
Today, 14:43
Joined
May 15, 2014
Messages
1,122
Set WShell = CreateObject("WScript.Shell")

You might be able to look at this code for some guidance?
click here
 

gcarpenter

Registered User.
Local time
Today, 13:43
Joined
Oct 21, 2013
Messages
68
I can change the code to this suggestion, but then it errors out on WScript.Echo and says object required. The runtime 424 error.
 

gcarpenter

Registered User.
Local time
Today, 13:43
Joined
Oct 21, 2013
Messages
68
VBA code in Excel does not necessarily work in access. The link will not help me.
 

pr2-eugin

Super Moderator
Local time
Today, 18:43
Joined
Nov 30, 2011
Messages
8,494
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:
 

gcarpenter

Registered User.
Local time
Today, 13:43
Joined
Oct 21, 2013
Messages
68
I replaced WScript.Echo with MsgBox and now the popup will not time out. Should that have made any difference?
 

pr2-eugin

Super Moderator
Local time
Today, 18:43
Joined
Nov 30, 2011
Messages
8,494
Can you please post the updated code?

Scratch that ! What is that you are trying to do in the first place?
 

gcarpenter

Registered User.
Local time
Today, 13:43
Joined
Oct 21, 2013
Messages
68
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

Top Bottom