By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

How to debug an ActiveX from VBscript?

P: n/a
Hi

I am kind of new to active-x programming, and need a point in the
right direction.

I have an active-x control that I wrote in VB6. I wrote a testbed in
VB and everything seems to work OK. I included the testbed and
active-x in the same project so I can refrence the active-x in design
time and when I run the testbed I can set breakpoints in the active-x
for debugging.

One of the methods is:

Public Function QueryBrandList(ByRef resString()) As Integer

'do some stuff here...

'be sure that we got some results before sending it off for
parsing

If strBrandList <> "" And strBrandList <> ";" Then

' parse the through the specs to build string array
resString = parse(strBrandList, ";")

' return number of results
QueryBrandList = UBound(resString)
Else
ThrowError 300, "No Brand List Returned"
QueryBrandList = -1
End If

End Function

(the parse function takes the string and splits it at the ";" and
returns the results as an array)

From VB I call QueryBrandList
Dim array()
Dim ret as integer

ret=object.QueryBrandList(array)
This works fine and I get back the number of elements and the array is
filled.

The problem is that I need to call this ActiveX from VBScript.
I don't know how to refrence the object from VBScript so that i can
set breakpoints in VB and debug it.
if I call it in VBScript this way

Dim array()
Dim ret

ret=object.QueryBrandList(array)
I get "Type Mismatch"

if I call it in VBScript this way

Dim array()
Dim ret

ret=object.QueryBrandList(array())
I get "Subscript out of range"

I am kind of stuck because I can't debug and see what is going on. Can
someone either tell me how or if it is possible to get a VBScript to
call the object so I can debug it, or explain why the VBScript doesn't
work the same way the VB does.

Thanks for taking time to read this long message and for any help you
can provide

regards,
T Robinson
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You can declare it as:
Public Function QueryBrandList(ByRef resString as variant) As Variant
You can pass an array to resString in the function.

Then in VBS:

Dim array1
Dim ret

ret = QueryBrandList(array1)
If ret > -1 then .....

--
--
Tash Robinson <ta***@kc-automation.com> wrote in message
news:2d**************************@posting.google.c om...
Hi

I am kind of new to active-x programming, and need a point in the
right direction.

I have an active-x control that I wrote in VB6. I wrote a testbed in
VB and everything seems to work OK. I included the testbed and
active-x in the same project so I can refrence the active-x in design
time and when I run the testbed I can set breakpoints in the active-x
for debugging.

One of the methods is:

Public Function QueryBrandList(ByRef resString()) As Integer

'do some stuff here...

'be sure that we got some results before sending it off for
parsing

If strBrandList <> "" And strBrandList <> ";" Then

' parse the through the specs to build string array
resString = parse(strBrandList, ";")

' return number of results
QueryBrandList = UBound(resString)
Else
ThrowError 300, "No Brand List Returned"
QueryBrandList = -1
End If

End Function

(the parse function takes the string and splits it at the ";" and
returns the results as an array)

From VB I call QueryBrandList
Dim array()
Dim ret as integer

ret=object.QueryBrandList(array)
This works fine and I get back the number of elements and the array is
filled.

The problem is that I need to call this ActiveX from VBScript.
I don't know how to refrence the object from VBScript so that i can
set breakpoints in VB and debug it.
if I call it in VBScript this way

Dim array()
Dim ret

ret=object.QueryBrandList(array)
I get "Type Mismatch"

if I call it in VBScript this way

Dim array()
Dim ret

ret=object.QueryBrandList(array())
I get "Subscript out of range"

I am kind of stuck because I can't debug and see what is going on. Can
someone either tell me how or if it is possible to get a VBScript to
call the object so I can debug it, or explain why the VBScript doesn't
work the same way the VB does.

Thanks for taking time to read this long message and for any help you
can provide

regards,
T Robinson

Jul 17 '05 #2

P: n/a
Mayayana,
Thanks for your help that worked great.

I am still wondering if there is a way to get VBScript to use the
ActiveX while running in VB, instead of compiled, so it can be
debugged.

Does anyone know how to to do this?

Thanks,
Tash Robinson
Jul 17 '05 #3

P: n/a
I don't know of any way to run VBS in the IDE, if that's
what you mean, but you can simulate it fairly closely by
running a test project that uses only variants with late
bound object creation. (File menu: Add Project. Then right - click
project2 name in project explorer and click "Set As Startup".
Then set a reference in project2 to component from project1.)

Late bound: Set Ob = CreateObject("Project1.object")
Early bound: Dim Ob as Project1.object
Set Ob = New Project1.object
--
--
Tash Robinson <ta***@kc-automation.com> wrote in message
news:2d**************************@posting.google.c om...
Mayayana,
Thanks for your help that worked great.

I am still wondering if there is a way to get VBScript to use the
ActiveX while running in VB, instead of compiled, so it can be
debugged.

Does anyone know how to to do this?

Thanks,
Tash Robinson

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.