' Original Code by Terry Kreft
' Modified by Stephen Lebans
' Contact Stephen@lebans.com
Option Compare Database
Option Explicit
'*********** 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 Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" _
(pChoosecolor As COLORSTRUC) As Long
Public Function aDialogColor(ByRef SelectedColor As Long, Optional PreSelectedColor As Variant) As Boolean
Dim x As Long, CS As COLORSTRUC, CustColor(16) As Long
' Were we passed a value in PreselectedColor
If Not IsMissing(PreSelectedColor) Then
CS.rgbResult = PreSelectedColor
End If
x = ChooseColor(CS)
If x = 0 Then
' ERROR - return preselected Color
aDialogColor = False
Exit Function
Else
' Normal processing
SelectedColor = CS.rgbResult
aDialogColor = True
End If
End Function
'*********** Code End ***********作者: gzh97730 时间: 2006-3-2 16:44
谢谢大家的热心解答,实在感动呀!我的文字表达能力可能次了点,补个图吧.(word的)