Solved

Calling object methods without direct

Posted on 1999-01-18
2
126 Views
Last Modified: 2010-05-03
This is a tough one.
I need to call methods in an ActiveX control BUT I can't use the standard object.method to call it. I will only know it's name at run-time.

I need (I know it doesn't exist in plain VB) something like object.methods["methodname"](var1, var2). I could live without any vars.

I also know this can be implemented using the IDispatch interface methods like GetIdsOfNames...

I'm looking for something generic which can take an object and analyze it's properties and methods. I could do it with Delphi or C++, but I need to do it in VB or use something ready.

Thanks.
0
Comment
Question by:ssite
2 Comments
 
LVL 3

Accepted Solution

by:
cognition earned 200 total points
Comment Utility
In VB6 you have the callbyname function.

CallByName(object, procedurename, calltype,[arguments()])

Combined with late binding [Set myob = CreateObject("Excel.Sheet")], you may be able to do what you want.

0
 
LVL 1

Author Comment

by:ssite
Comment Utility
EXCELLENT COGNITION. Send me an e-mail to ssite@netvision.net.il for a little chat :-)
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now