> >> Does not Work
Alright, let me "correct" what I just said... in the case of CallByName,
yes, that second argument is supposed to be given as a String value
(that's what the syntax calls for). I answered your original post
without thinking carefully enough about what you were trying to do. Now,
as to why your code didn't work... Click is not method of the
CommandButton, it is an event of the CommandButton. CallByName
apparently doesn't not accept events as an argument.
Can you describe what part of the CommandButton call you are trying to
make is not known beforehand... the control array being specified, the
index for a control array, or both? I will point out, if it helps, that
if you know which control array you want, but want to specify the index
dynamically, then this will work...
Command1(SomeIndex).Value = True
where SomeIndex can be specified dynamically. Setting the Value of a
CommandButton to True triggers its Click event.
Rick - MVP