Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Altering Textbox Colour

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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.718 / Virus Database: 474 - Release Date: 09/07/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Altering Textbox Colour

The .Interior.ColorIndex is associated with an excel cell, not
textbox, so it doesn't apply here.

If this is a textbox from the controls toolbar and is put onto
worksheet (since I cannot seem to get a forms textbox to go onto
worksheet), you would use this format:

TextBox1.BackColor = RGB(0, 128, 64)

Check out the BackColor and RGB in VB Help to get the specifics.



--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Altering Textbox Colour

kkknie,

The .Interior.ColorIndex is associated with an excel
cell, not a textbox, so it doesn't apply here.


Create a Textbox from the Drawing toolbar, select it and
try these:

Selection.Interior.ColorIndex = 3
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 50


If this is a textbox from the controls toolbar and is put
onto aworksheet (since I cannot seem to get a forms
textbox to go onto a worksheet), you would use this
format:

TextBox1.BackColor = RGB(0, 128, 64)


This is applying a Long RGB, as I previously suggested

Regards,
Peter

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Altering Textbox Colour

Many thanks all, for the help.

Regards.

"Peter T" wrote in message
...
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.




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.718 / Virus Database: 474 - Release Date: 09/07/2004




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Altering Textbox Colour

Try something like

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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Stuart" wrote in 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.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.718 / Virus Database: 474 - Release Date:

09/07/2004




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
textBox font colour the same as cell font colour???????? Sophie Excel Discussion (Misc queries) 4 February 13th 09 10:15 AM
copy cell font colour to textbox? Sophie Excel Discussion (Misc queries) 0 January 28th 09 01:03 AM
Textbox font colour change? Tdp Excel Discussion (Misc queries) 6 January 24th 09 05:11 PM
textbox font colour Pilot Excel Discussion (Misc queries) 2 March 25th 08 03:13 PM
Change colour of font in a textbox? capt Excel Discussion (Misc queries) 2 January 24th 08 04:51 PM


All times are GMT +1. The time now is 08:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"