Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Determine Application window color

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Maxey - 16 Feb 2007 15:40 GMT
I can right click the desktop, select properties, click appearance
tab, click in the window text area to set a "off white" application
window color for all my applications including Word.

Does anyone know how to determine the color of the application window
programatically with Word?

For example, if I use "white" font color to mask out text or table
borders, etc, the the result is a lightly visible text or border. I
need code something like this:

Selection.Font.Color = Application.Window.Color

Where application window color is determined programatically.

Thanks.
Harold Druss - 17 Feb 2007 12:40 GMT
>I can right click the desktop, select properties, click appearance
> tab, click in the window text area to set a "off white" application
[quoted text clipped - 12 lines]
>
> Thanks.

Try this:
*******************************************************************************************************************************
Private Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long,
lpSysColor As Long, lpColorValues As Long) As Long
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As
Long
Const COLOR_SCROLLBAR = 0 'The Scrollbar colour
Const COLOR_BACKGROUND = 1 'Colour of the background with no wallpaper
Const COLOR_ACTIVECAPTION = 2 'Caption of Active Window
Const COLOR_INACTIVECAPTION = 3 'Caption of Inactive window
Const COLOR_MENU = 4 'Menu
Const COLOR_WINDOW = 5 'Windows background
Const COLOR_WINDOWFRAME = 6 'Window frame
Const COLOR_MENUTEXT = 7 'Window Text
Const COLOR_WINDOWTEXT = 8 '3D dark shadow (Win95)
Const COLOR_CAPTIONTEXT = 9 'Text in window caption
Const COLOR_ACTIVEBORDER = 10 'Border of active window
Const COLOR_INACTIVEBORDER = 11 'Border of inactive window
Const COLOR_APPWORKSPACE = 12 'Background of MDI desktop
Const COLOR_HIGHLIGHT = 13 'Selected item background
Const COLOR_HIGHLIGHTTEXT = 14 'Selected menu item
Const COLOR_BTNFACE = 15 'Button
Const COLOR_BTNSHADOW = 16 '3D shading of button
Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.
Const COLOR_BTNTEXT = 18 'Button text
Const COLOR_INACTIVECAPTIONTEXT = 19 'Text of inactive window
Const COLOR_BTNHIGHLIGHT = 20 '3D highlight of button
Const COLOR_2NDACTIVECAPTION = 27 'Win98 only: 2nd active window color
Const COLOR_2NDINACTIVECAPTION = 28 'Win98 only: 2nd inactive window color

Sub MatchSelectedTextFontWithBackground()
Dim l As Long
l = GetSysColor(COLOR_WINDOW)
Selection.Font.Color = l
End Sub
*******************************************************************************************************************************
Good luck
Harold
Greg Maxey - 17 Feb 2007 14:58 GMT
Harold,

No it is this one and it is perfect.  Thank you.

Signature

Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

>> I can right click the desktop, select properties, click appearance
>> tab, click in the window text area to set a "off white" application
[quoted text clipped - 51 lines]
> Good luck
> Harold
Harold Druss - 17 Feb 2007 12:58 GMT
>I can right click the desktop, select properties, click appearance
> tab, click in the window text area to set a "off white" application
[quoted text clipped - 12 lines]
>
> Thanks.

After taking a closer look:

************************************************************
Sub MatchSelectedTextFontWithBackground()

Selection.Font.Color = ActiveDocument.Background.Fill.BackColor.RGB

End Sub
************************************************************

Good luck
Harold
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.