Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 262
Default How to display Color Palette with vba code

I am trying to pop up the Color Palette to allow a user to pick a color, then
use that color as a background for selected cells. In the past, I have used
the Common Dialog Control to allow users to pick a color. It seems that the
control has disappeared from my list of available controls. Is it not
available in VBA for Office 2003?

I also tried using the XlBuiltInDialog.xlDialogColorPalette but can't seem
to get it to work. Any code samples would be greatly appreciated.
--
Keith
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to display Color Palette with vba code

Keith,

Here is a function that can use the built-in colour dialog

'-----------------------------*------------------------------*--------------
--
Function GetColorindex(Optional Text As Boolean = False) As Long
'-----------------------------*------------------------------*--------------
--
Dim rngCurr As Range

Set rngCurr = Selection
Application.ScreenUpdating = False
Range("IV1").Select
Application.Dialogs(xlDialogPatterns).Show
GetColorindex = ActiveCell.Interior.ColorIndex
If GetColorindex = xlColorIndexAutomatic And Not Text Then
GetColorindex = xlColorIndexNone
End If
ActiveCell.Interior.ColorIndex = xlColorIndexAutomatic
rngCurr.Select
Set rngCurr = ActiveSheet.UsedRange
Application.ScreenUpdating = True
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Keith" wrote in message
...
I am trying to pop up the Color Palette to allow a user to pick a color,

then
use that color as a background for selected cells. In the past, I have

used
the Common Dialog Control to allow users to pick a color. It seems that

the
control has disappeared from my list of available controls. Is it not
available in VBA for Office 2003?

I also tried using the XlBuiltInDialog.xlDialogColorPalette but can't seem
to get it to work. Any code samples would be greatly appreciated.
--
Keith



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
Color Palette JAD Excel Discussion (Misc queries) 1 November 19th 07 02:26 AM
Bring up Color Palette to select color pokdbz Excel Discussion (Misc queries) 4 August 6th 07 10:13 PM
Color Palette, color disappears Emil Excel Discussion (Misc queries) 3 November 29th 05 05:07 AM
Color Palette ExcelMonkey[_190_] Excel Programming 1 February 22nd 05 06:40 PM
Changing color in color palette Dave Peterson Setting up and Configuration of Excel 0 December 12th 04 02:39 PM


All times are GMT +1. The time now is 09:37 PM.

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

About Us

"It's about Microsoft Excel"