2

Hi can anyone tell me how to execute my .vbs from within VBA cause the following code dose not work.

RetBat4 = Shell("c:\VTS\QUEEN ANNES REVENGE\SYSTEM\VBS\UNDO_2.vbs", 1)

VBA debug says that the sytax is wrong????

thanks

2 Answers 2

1

Try

Shell("cscript ""c:\VTS\QUEEN ANNES REVENGE\SYSTEM\VBS\UNDO_2.vbs""",1)

If your VBS needs complete command shell environment, use this:

Shell("cmd /c cscript ""c:\VTS\QUEEN ANNES REVENGE\SYSTEM\VBS\UNDO_2.vbs""",1)

and if your program should wait until the VBS ends, read this post:

VBA Shell and Wait with Exit Code

Sign up to request clarification or add additional context in comments.

Comments

0

try This:

Set ws=CreateObject("Wscript.shell")
set ws.exec("ping " & ip & " -n 20")
set ws=nothing

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.