BackStyle Property misbehavior

L

Lyndon Rickards

Greetings,

Sorry for crosspost. Figured maybe more appropriate here than
M.P.Excel where I tried yesterday...or does the question even
make sense?

The sequence below works to create and then set options on
CommandButton1, Label1 and Frame1 objects - *except* that
the visual effect of BackStyle is not seen.

Public Sub addLabel()
Sheet2.OLEObjects.Add "Forms.Label.1", _
Left:=100, Top:=75, Height:=15, Width:=200
End Sub

Public Sub nameLabel()
Sheet2.Label1.Name = "title1"
End Sub

Public Sub setLabel()
Sheet2.title1.BackStyle = 0
Sheet2.title1.Caption = "My Text"
Sheet2.title1.Font.Bold = 1
Sheet2.title1.Font.Italic = 1
Sheet2.title1.Font.Size = 12
End Sub


However, the value *is* set correctly per the script when I look at the
object properties after the sheet is created and all these objects added.

Changing the property manually in the properties dialog *on those
objects created by the script* also has no visual effect - the
label/button/frame keeps it's white background.

OTOH, if I add a Label manually, I can set BackStyle to 0 and it
immediately becomes transparent.

All other properties (except size/location) are identical to the
manually-created 'control' that does accept and reflect the value of
BackStyle.

Saving and re-opening the file doesn't change appearance or behavior any.

What am I missing, beyond that it smells like a bug? By the way, I have
the same behavior on excel 2000 and 2003 and on several different machines.

Side question - Add say a Command1 button manually to the sheet from the
toolbar. Right-click on it to get to the menu with 'properties' on it.
It seems to be hit-or-miss whether the full menu or an abbreviated one
without 'Properties' comes up. Do these things have 'hot' areas that
produce different menus? Or what?

TIA - Lynn.
 
P

Peter T

Hi Lynn,

Unfortunately setting the backstyle of ActiveX worksheet controls to
transparent does not persist, at least not after clicking.

Concerning the right click context menu, normally the commandbar named
"ActiveX Control" ought to pop-up with Properties & View code items. But an
ActiveX is also a Shape so the "Shapes" or "Excel Control" toolbars might
popup in slightly different circumstances, particularly if you have more
than one selected.

Regards,
Peter T

Lyndon Rickards said:
Greetings,

Sorry for crosspost. Figured maybe more appropriate here than
M.P.Excel where I tried yesterday...or does the question even
make sense?

The sequence below works to create and then set options on
CommandButton1, Label1 and Frame1 objects - *except* that
the visual effect of BackStyle is not seen.

Public Sub addLabel()
Sheet2.OLEObjects.Add "Forms.Label.1", _
Left:=100, Top:=75, Height:=15, Width:=200
End Sub

Public Sub nameLabel()
Sheet2.Label1.Name = "title1"
End Sub

Public Sub setLabel()
Sheet2.title1.BackStyle = 0
Sheet2.title1.Caption = "My Text"
Sheet2.title1.Font.Bold = 1
Sheet2.title1.Font.Italic = 1
Sheet2.title1.Font.Size = 12
End Sub


However, the value *is* set correctly per the script when I look at the
object properties after the sheet is created and all these objects added.

Changing the property manually in the properties dialog *on those
objects created by the script* also has no visual effect - the
label/button/frame keeps it's white background.

OTOH, if I add a Label manually, I can set BackStyle to 0 and it
immediately becomes transparent.

All other properties (except size/location) are identical to the
manually-created 'control' that does accept and reflect the value of
BackStyle.

Saving and re-opening the file doesn't change appearance or behavior any.

What am I missing, beyond that it smells like a bug? By the way, I have
the same behavior on excel 2000 and 2003 and on several different machines.

Side question - Add say a Command1 button manually to the sheet from the
toolbar. Right-click on it to get to the menu with 'properties' on it.
It seems to be hit-or-miss whether the full menu or an abbreviated one
without 'Properties' comes up. Do these things have 'hot' areas that>
produce different menus? Or what?
 
L

Lyndon Rickards

Thank you Peter for at least confirming my sanity, and
one of the clunkier areas of Micro$loth.

- Lynn.
 

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