Excel VBA: how do I change a button's caption?

  madwab 11:12 31 Dec 2004
Locked

I'd like to change the properties of various objects on the fly, starting with the caption on a button. As usual the help files don't, but they seem to imply that

CommandButton1.Caption=x, or
x=CommandButton1.Caption

...should work for a button named CommandButton1. They don't, so (for example)

Sub Macro1()
Dim c
c = CommandButton1.Caption
End Sub

...gives run time error 424, object required.

What should I be using?

Thanks

  madwab 11:23 31 Dec 2004

Sheets("Sheet1").CommandButton1.Caption=x!

  JaßîsFaß ˜ 11:31 31 Dec 2004

Is this a new gam? Ask a question first, and then see if you can personally beat the other forum members to providing the answer?

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Dell XPS 13 9370 (2018) review

The art of 'British' pulp fiction

Best password managers for Mac

TV & streaming : comment regarder le Tournoi des Six Nations 2018 ?