LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default need form pulldown white while box is color

Leith,
Thanks for the quick reply, works great.
Steve

"Leith Ross" wrote:


Hello Steve,

If we had access to window handles in VBA this would be easy. This code
is a work around to your problem. You specify the backcolor of each
ComboBox (aka Pull Down or Drop Down) in the UserForm's intialize
event. When the user clicks the drop down arrow, the backcolor property
is set to white. When clicked a second time or when the focus is lost,
the backcolor is restored to your original color. All the color values
are RGB values.

You need to add a line of code to each ComboBox's DropDownClick event
to call the backcolor macro. This was easiest code method I could
devise. The code is in 2 parts: First the UserForm event codes, and
secod the macro module. I use only 2 ComboBoxes in this example, but
you can you use as many as you need.

USERFORM EVENT CODE
_____________________________


Code:
--------------------
Private Sub ComboBox1_DropButtonClick()

Call ChangeBackColor(ComboBox1)

End Sub

Private Sub ComboBox2_DropButtonClick()

Call ChangeBackColor(ComboBox2)

End Sub

Private Sub UserForm_Initialize()

On Error Resume Next
With ComboList
.Add vbBlue, ComboBox1.Name
.Add vbYellow, ComboBox2.Name
End With
If Err.Number = 457 Then Err.Clear

End Sub
_____________________________

MACRO MODULE CODE
_____________________________

Public ShowList As Boolean
Public ComboList As New Collection

Public Sub ChangeBackColor(ByRef CB As MSForms.ComboBox)

ID = CB.Name

With CB
If Not ShowList Then
.BackColor = vbWhite
Else
.BackColor = Val(ComboList(ID))
End If
End With

ShowList = Not ShowList

End Sub

--------------------

_____________________________

Happy Holidays,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=495936


 
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
Excessive white space at bottom of form when printing. akkrug New Users to Excel 2 July 10th 08 07:43 PM
Color doesn't display -all black & white Sally in Cleveland Excel Worksheet Functions 0 May 16th 08 01:35 PM
Microsoft Templates use white for fill color, why? dk_ Excel Discussion (Misc queries) 8 October 11th 06 04:32 PM
color page display black and white shelbo Excel Worksheet Functions 0 August 10th 06 06:13 PM
PlotArea.Interior.Color ... all white Markus Grein Excel Programming 2 February 8th 04 04:06 PM


All times are GMT +1. The time now is 05:33 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"