Solved

Visual Basic DLL call from VBScript???

Posted on 2004-09-01
7
758 Views
Last Modified: 2013-11-25
Hi,

Does anyone know why a component (ActiveX EXE) created in Visual Basic 6.0 sp5 cannot be run directly from within IE6 or even directly from a .vbs file. OK, I know that IE6 is down to security reason, but what about the .vbs file?

I have code similar to this, where my main application is a ActiveX EXE and it exposes various methods, functions, properties and events. I have written similar code in VB6.0 and it works without any problems. If I run it within either one i.e. IE6 or .vbs, it tells me that my property does not exist when I know it does.

Code sample:

Dim myObj

Set myObj = CreateObject("MyApp.CMyApp")

msgbox MyApp.UID (This works!)
msgbox MyApp.Search.Text("My Field") = "TEST" (This does not work. Tells me that the property does not exists i.e. error 438)

yet this one will work, ok, I know they are different, but it still does not explain why the above work in vb6

msgbox MyApp.Search.Text.Count ' return 6

Appreciate any feedback.

Thanks.

T.
0
Comment
Question by:taf
  • 2
7 Comments
 
LVL 11

Expert Comment

by:SweatCoder
ID: 11954752
i've called dll's from vbs and it works fine. is the dll registered?
0
 
LVL 8

Accepted Solution

by:
mladenovicz earned 250 total points
ID: 11954846
You should use myObj instead of MyApp

Dim myObj

Set myObj = CreateObject("MyApp.CMyApp")

msgbox myObj.UID
msgbox myObj.Search.Text

........

Set myObj = Nothing
0
 

Author Comment

by:taf
ID: 12032359
Hi,

It is definitely registered as I mentioned, it can access the first level of the properties contains in my object i.e. obj.count will work, but not obj.lines.count for example.

Remember as well it is not a dll but a ActiveX Server (.EXE), so maybe that is the problem.

As for my naming convension, this was just for the sake of the example. I would never user MyApp or MyObj either way. That's not really the type of feedback I was looking for????

Thanks.

T.
0
 
LVL 8

Expert Comment

by:mladenovicz
ID: 12563908
I did not talk about your naming convention.  Your code uses variable that is not declared

Set myObj = CreateObject("MyApp.CMyApp")   '-- here is MyObj

msgbox MyApp.UID (This works!)
msgbox MyApp.Search.Text("My Field") = "TEST" '-- here is MyApp, but you declared myObj
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
passing a value with stream reader AFTER a ";" 3 75
vbModal 12 57
MS Access 03, TransferText, decimal places 8 78
Set WorkSheet  not Working 9 44
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question