Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual Basic DLL call from VBScript???

Posted on 2004-09-01
7
Medium Priority
?
771 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

719 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