P
Peter Hibbs
I am trying to use the Color Picker code at :-
http://www.mvps.org/access/api/api0060.htm
to select a color (see code below).
The code works fine except that I would like the current color (which
is passed to the function in a variable called ColorValue) to be
displayed on the color picker dialog Color box. Does anyone know how
to do this.
Here is the (slightly modified) code I am using.
Option Compare Database
Option Explicit
' Original Code by Terry Kreft
' Modified by Stephen Lebans
' Contact (e-mail address removed)
'*********** Code Start ***********
Private Type COLORSTRUC
lStructSize As Long
hwnd As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Const CC_SOLIDCOLOR = &H80
Private Const CC_OPENALL = &H2
Private Declare Function ChooseColor Lib "comdlg32.dll" Alias
"ChooseColorA" _
(pChoosecolor As COLORSTRUC) As Long
Public Function DialogColor(ColorValue As Long) As Long
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long
CS.lStructSize = Len(CS)
CS.hwnd = hWndAccessApp
CS.Flags = CC_SOLIDCOLOR Or CC_OPENALL
CS.lpCustColors = String$(16 * 4, 0)
x = ChooseColor(CS)
If x = 0 Then Exit Function
DialogColor = CS.rgbResult
End Function
'*********** Code End ***********
TIA
Peter Hibbs.
http://www.mvps.org/access/api/api0060.htm
to select a color (see code below).
The code works fine except that I would like the current color (which
is passed to the function in a variable called ColorValue) to be
displayed on the color picker dialog Color box. Does anyone know how
to do this.
Here is the (slightly modified) code I am using.
Option Compare Database
Option Explicit
' Original Code by Terry Kreft
' Modified by Stephen Lebans
' Contact (e-mail address removed)
'*********** Code Start ***********
Private Type COLORSTRUC
lStructSize As Long
hwnd As Long
hInstance As Long
rgbResult As Long
lpCustColors As String
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Const CC_SOLIDCOLOR = &H80
Private Const CC_OPENALL = &H2
Private Declare Function ChooseColor Lib "comdlg32.dll" Alias
"ChooseColorA" _
(pChoosecolor As COLORSTRUC) As Long
Public Function DialogColor(ColorValue As Long) As Long
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long
CS.lStructSize = Len(CS)
CS.hwnd = hWndAccessApp
CS.Flags = CC_SOLIDCOLOR Or CC_OPENALL
CS.lpCustColors = String$(16 * 4, 0)
x = ChooseColor(CS)
If x = 0 Then Exit Function
DialogColor = CS.rgbResult
End Function
'*********** Code End ***********
TIA
Peter Hibbs.