joe.afusco
Board Regular
- Joined
- Jun 25, 2010
- Messages
- 80
Anyone know the syntax to execute a script from VBA?
Option Explicit
Sub Execute_VBScript_from_VBA()
' hiker95, 03/02/2012
' http://www.mrexcel.com/forum/showthread.php?t=618285
Call TestA
Call TestB
End Sub
Sub TestA()
MsgBox "Running/executing macro 'TestA' !"
End Sub
Sub TestB()
MsgBox "Running/executing macro 'TestB' !"
End Sub
'in Excel module
Sub Test()
Shell "Explorer.exe ""C:\Some Folder\MyVBSFile.vbs""",1
End Sub
Why explorer rather than wscript or cscript? If the reason is using the default association, more robust to use
Shell Environ("COMSPEC") & " /c start """" ""script path here""", 1