Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Basic DLL call from VBScript???

Posted on 2004-09-01
7
Medium Priority
?
775 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
4 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

782 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