ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calling a method on a object that you know the string name for. (https://www.excelbanter.com/excel-programming/381067-calling-method-object-you-know-string-name.html)

scotty[_2_]

calling a method on a object that you know the string name for.
 

say you have an object, and you want to call a method, but that method
name is a string.

is there a way to execute this method?

obviously, you can't do

obj.methodname

need something like

Invoke(obj, "methodname")... to execute that method on the object.


[email protected]

calling a method on a object that you know the string name for.
 
Check out CallByName. I think it does what you're talking about.


scotty wrote:
say you have an object, and you want to call a method, but that method
name is a string.

is there a way to execute this method?

obviously, you can't do

obj.methodname

need something like

Invoke(obj, "methodname")... to execute that method on the object.




All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com