I have the following vba function ( in a module in Excel file)
Public Function validate_fncname(strFncname As String) As Boolean
.
.
.
validate_fncname = True
End Function
and I wrote the following vbscript to call it :
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Users\uidu8611\Desktop\CAM0500040F10_SW_Quality_Assurance_Report_Template(new_version).xlsm")
objExcel.Application.Visible = True
Dim str
str ="hello"
Dim validate_fncname
validate_fncname = objExcel.Application.Run("'C:\Users\uidu8611\Desktop\CAM0500040F10_SW_Quality_Assurance_Report_Template(new_version).xlsm'!validate_fncname", str)
Wscript.Echo validate_fncname
however when I run the script, it gives me type mismatch error for the line:
objExcel.Application.Run("'C:\Users\uidu8611\Desktop\CAM0500040F10_SW_Quality_Assurance_Report_Template(new_version).xlsm'!validate_fncname", str)
Despite the fact that the type is correct (String)
furthermore if I change it to :
objExcel.Application.Run("'C:\Users\uidu8611\Desktop\CAM0500040F10_SW_Quality_Assurance_Report_Template(new_version).xlsm'!validate_fncname(5)")
It doesn't give me an error, although 5 is integer!
Where is my mistake please?
run.