Naming UserForm CommandButtons using VBA

P

PCLIVE

This is slightly different than something I asked yesterday. Unfortunately,
applying yesterday's solution method does not work for this.
I'm trying to name a series of command buttons on a UserForm. Can you use
code to name commandbuttons on a Userform? This is what I got which doesn't
work.


For i = 1 To 37
c = 38

UserForm3.Controls("CommandButton" & i).Name = "M" & c

c = c + 1
Next i


Thanks,
Paul
 
B

Bob Phillips

No you didn't, you asked how to set the caption. You cannot set the name
property at runtime, just like the error message told you.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
P

PCLIVE

Thanks Bob,

I wasn't saying that this was the same question, which as you pointed out
was dealing with setting the Caption properties. Your suggested solution
yesterday was dead-on and helped me accomplish exactly what I wanted.. But
I trying something different today, but still dealing with the UserForm
CommandButton Properties. Anyway, I had a feeling that this one couldn't be
done.

As always, thanks for your help.
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top