passing array from VBScript to Visual Basic ActiveX DLL 
Author Message
 passing array from VBScript to Visual Basic ActiveX DLL

I have an array Data() in my VBScript that I am trying to pass into
a function declared in Visual Basic ActiveX DLL project compliled to
a DLL:

File: MyDebug.wsf
<job>
 <script language="vbscript">
  Dim Data(1,1)
  Data(0,0)="1"
  Data(1,0)="too"
  Data(0,1)="3.0"
  Data(1,1)="four"
  Set obj = CreateObject("MyDebug.Debug")
  obj.DoIt  Data()
 </script>
</job>

Visual Baisic Function:
Public Function DoIt(Data() As Variant) As String
    DoIt = "Done"
End Function

I keep getting an error "Subscript out of range". How can you set things
up to pass an array between VBScript and a Visual Basic created ActiveX DLL?



Fri, 20 Aug 2004 00:04:10 GMT  
 passing array from VBScript to Visual Basic ActiveX DLL
Drop the ()s when you pass the array as an argument...

  obj.DoIt  Data

Q217114 - HOWTO: Implement Array Arguments in Visual Basic COM Objects for Active Server Pages
http://support.microsoft.com/support/kb/articles/Q217/1/14.ASP

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> I have an array Data() in my VBScript that I am trying to pass into
> a function declared in Visual Basic ActiveX DLL project compliled to
> a DLL:

> File: MyDebug.wsf
> <job>
>  <script language="vbscript">
>   Dim Data(1,1)
>   Data(0,0)="1"
>   Data(1,0)="too"
>   Data(0,1)="3.0"
>   Data(1,1)="four"
>   Set obj = CreateObject("MyDebug.Debug")
>   obj.DoIt  Data()
>  </script>
> </job>

> Visual Baisic Function:
> Public Function DoIt(Data() As Variant) As String
>     DoIt = "Done"
> End Function

> I keep getting an error "Subscript out of range". How can you set things
> up to pass an array between VBScript and a Visual Basic created ActiveX DLL?



Fri, 20 Aug 2004 03:26:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing arguments to Visual Basic DLL

2. Ghostscript DLL and Visual Basic

3. Autoregister DLL in Visual Basic

4. Convert Access Visual Basic + DLL to ASP?

5. Err Type Mismatch when vbscript accesses array from an ActiveX dll

6. Passing Arrays into VbScript from a VB dll

7. Visual Basic / ActiveX Question

8. Passing arrays from VBScript to VB DLL

9. Passing array from ASP (VBScript) to DLL and back

10. Passing Arrays to a VB 5.0 SP3 DLL using VBScript control

11. Passing Arrays between ASP/VBScript and ActiveX Components...

12. Control arrays in Visual Basic

 

 
Powered by phpBB® Forum Software