Why doesnt this work?
What about trying to set a reference to it using ThisWorkbook? I'm not able
to test this, but it may work:
Dim cmd As CommandBarButton
Set cmd = ThisWorkbook.Sheets("Main").CommandButtonAdd
I've had a similar problem to this when working with named ranges, and I
still haven't found the solution. Hopefully, this workaround might help.
HTH,
Matthew Pfluger
" wrote:
Dim MainWorksSheet As Worksheet
Set MainWorksSheet = ThisWorkbook.Worksheets("Main") *Yes the
worksheet is named Main.
MainWorksSheet.CommandButtonAdd.Enabled = True
MainWorksSheet.CommandButtonMakeBusy.Caption = "Start"
**Both being a button created with the control toolbox.
I get the error : Method or Data member not found.
On the other hand :
ActiveSheet.CommandButtonAdd.Enabled = True
ActiveSheet.CommandButtonMakeBusy.Caption = "Start"
Works fine! Unless the focus is on a different sheet named something
else.
I need to make sure that it refers to the sheet "Main" because I have
other sheets and if they have the focus then the ActiveSheet doesnt
work either.
Thanks for any help.
|