Solved

Calling object methods without direct

Posted on 1999-01-18
2
127 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
ID: 1469253
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
ID: 1469254
EXCELLENT COGNITION. Send me an e-mail to ssite@netvision.net.il for a little chat :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

929 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

12 Experts available now in Live!

Get 1:1 Help Now