How to call vbscript function from vba
I have function in test.vbs file
Public Function fn_add(a,b)
c = a + b
from excel vba trying to call but it's not working.
Private Sub btnExecution_Click()
On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Set oobj = objShell.Run("C:\Test.vbs fn_add", "5", "6")
Set objShell = Nothing
any idea that how to call vb script function with parameters from vba
Last edited by pvvsrk; 10-30-2015 at 02:26 AM.
I think there shouldnot be any commas between arguements.
Set objShell = CreateObject("WScript.Shell")
objShell.Run "ipconfig -all",0,True
The CMD prompt will not be shown (0) and our script will wait till the program exits before it continues processing (True).