RAYLWARD102
Well-known Member
- Joined
- May 27, 2010
- Messages
- 529
I've got a vbscript that passes a variable to excel.
It currently and successfully can deliver a single value to excel.
I'm attempting to send an array; not having any luck.
The excel code receives the variable and debug.print confirms the variable is an array, but as soon as you try to access the contents of the array, it errors
Here is the excel receiving macro:
Here is the VBscript:
It currently and successfully can deliver a single value to excel.
I'm attempting to send an array; not having any luck.
The excel code receives the variable and debug.print confirms the variable is an array, but as soon as you try to access the contents of the array, it errors
Here is the excel receiving macro:
Code:
Sub Test(SomeArray As Variant)
Select Case IsArray(SomeArray)
Case True
Debug.Print "yes " & Now
Debug.Print UBound(SomeArray)
Case False
Debug.Print "not " & Now
End Select
End Sub
Here is the VBscript:
Code:
Dim FileCount()
On Error Resume Next
Err.Clear
Set objExcel = GetObject( , "Excel.Application")
Set objWorkbook = objExcel.Workbooks("pass vbcript array to excel.xlsm")
If Err.Number <> 0 Then
Set objFSO = Nothing
WScript.Quit
End If
FileCount = Split("1,2,3,4",",")
objExcel.Application.Run "Module1.Test", FileCount
Set objWorkbook = Nothing
Set objExcel = Nothing