'use of commondialogbox '1: choose printer '2: choose font '3: choose color '1: choose printer PublicReturnsub
ChoosePrinter Const ErrCancel = 32755 CommonDialog1.CancelError = True On Error GoTo errorPrinter CommonDialog1.Flags = 64 'see thehelp
on Flags Properties (Print Dialog) CommonDialog1.ShowPrinter CommonDialog1.PrinterDefault = Falseexit
Sub errorPrinter: If Err = ErrCancel Thenexit
sub
Else Resume End Sub '2: choose font Global vScreenFont, vScreenFontSize Publicsub
ChooseFont() CommonDialog1.Flags = cdlCFScreenFonts 'see thehelp
on Flags Properties (Font Dialog) CommonDialog1.ShowFont vScreenFont = CommonDialog1.FontName vScreenFontSize = CommonDialog1.FontSize Call ChangeFont(Form1) End Sub Publicsub
ChangeFont(Xas
Form)dim
Control For Each Control In X.Controls If TypeOf Control Islabel
Or _ TypeOf Control Is TextBox Or _ TypeOf Control Is CommandButton Or _ TypeOf Control Is ComboBox Or _ TypeOf Control Is ListBox Or _ TypeOf Control Is CheckBox Then Control.Font = vScreenFont Control.FontSize = vScreenFontSizeend
If Next Control End Sub '3: choose color Global vColor Publicsub
ChooseColor CommonDialog1.Flags = &H1& Or &H4& 'see thehelp
on Flags Properties (Color Dialog) CommonDialog1.ShowColor vColor = CommonDialog1.Color ' if youwant
to convert the color to hex use ' MsgBox Convert2Hex(vColor) ' if youwant
to repaint youre background use ' Call ChangeColor(Xas
Form) End Sub Publicsub
ChangeColor(Xas
Form)dim
Control X.BackColor = vColor For Each Control In X.Controls If TypeOf Control Islabel
Or _ TypeOf Control Is TextBox Or _ TypeOf Control Is CommandButton Or _ TypeOf Control Is ComboBox Or _ TypeOf Control Is ListBox Or _ TypeOf Control Is CheckBox Then Control.BackColor = vColorend
If Next Control End Sub Public Function Convert2Hex(color)as
String Dim RedValue, GreenValue, BlueValue RedValue = (color And &HFF&) GreenValue = (color And &HFF00&) \ 256 BlueValue = (color And &HFF0000) \ 65536 Convert2Hex = Format(Hex(RedValue) & Hex(GreenValue) & Hex(BlueValue), "000000") End Function