Problem setting BackStyle with script

L

Lyndon Rickards

Greetings,

Apologies if this question looks like a duplicate. The only
place I can see it posted since Saturday is in the ng view thru Google
groups.

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.
 

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