Font Color and Font Dialog Problem

M

Marty

I am trying to display the Font dialog and return the font color
selected by the User. I get the result back correctly for some
colors, but not for others. Here's my test macro.

MyFontColor is a static variable and if I run it once, select a color,
and then re-run it, the selected color is displayed SOMETIMES (e.g.,
if I select Red or Blue), but does NOT work if I select "Orange" or
"Rose", for example.

Sub ColorTest
Dim MyFontDlg As Dialog
Static MyFontColor
Dim res

Set MyFontDlg = Application.Dialogs(wdDialogFormatDefineStyleFont)
MyFontDlg.Color = MyFontColor
Dacapo:
res = MyFontDlg.Display
If res = 0 Then
Exit Sub
Else
MyFontColor = MyFontDlg.Color
End If

End Sub


Anyone have any ideas?

Thanks.
 
A

Anand.V.V.N

Hi Marty,
I think so if you use color.rgb might help i.e instead of

MyFontColor = MyFontDlg.Color
use

MyFontColor = MyFontDlg.Color.RGb

Might help you

Hope you found this useful.

Anand.
 
M

Marty

Hi Marty,
I think so if you use color.rgb might help i.e instead of

MyFontColor = MyFontDlg.Color
use

MyFontColor = MyFontDlg.Color.RGb

Might help you

Hope you found this useful.

Anand.

Thank you very much for your suggestion. This does, indeed, work.

Marty
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top