View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
cate cate is offline
external usenet poster
 
Posts: 93
Default button name scope and Caption

I have a main sheet that I replicate as 'what if' versions. There are
no collisions with any names on these copies since all code refers to
them in the context of the sheet.

Except for buttons and their attribute Caption.

There is one these buttons that has it's caption changed ('Show',
'Hide') but even within the context of the current sheet, it fails.

wS.Buttons("button_show_hide").Caption = "Hide"

What is REALLY strange is that the caption seems to be changing
somewhere, because the decision to Show or Hide is based on the
following. Again, this is successful:

StrComp(wS.Buttons("button_show_hide").Caption, "Hide")

The main sheet, from which all these 'What if's are copied, it's
button continues to work just fine. The caption toggles.

Anyone have an idea how to fix this?