View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_3_] Peter T[_3_] is offline
external usenet poster
 
Posts: 81
Default Altering Textbox Colour

If your TextBox is from the Controls Toolbox menu, it only
accepts a long RGB colour, or a System colour, try:

oleObj.Object.BackColor = ThisWorkbook.Colors(34)

You may or may not need the ".Object" depending on how
oleObj has been set and whether it is a textbox on a sheet
or on a form.

(Textboxes from the Drawing toolbar have different
properties, incl .Interior.Colorindex
and .Fill.Backcolor.Schemecolor).

Regards,
Peter


-----Original Message-----
Cannot find a way to change the colour of the 'fill'
in a textbox.

ElseIf oleObj.Name = "Control 2" Then
With oleObj
.Visible = True
.Enabled = True
.Interior.ColorIndex = 34
'get the cursor in the textbox
.Activate
End With
End If

will run without error, but with no apparent change to the
textbox. Tried BackColor too.

I need to be able to toggle between ColorIndexes
2 and 34. How is this done, please?

Regards.