PC Review


Reply
Thread Tools Rate Thread

Change color of title bar on user form

 
 
Jeff Wright
Guest
Posts: n/a
 
      15th Oct 2006
Greetings all,

Is there a way of changing the color of the title bar on a user form? I
can't see any such attribute change under Properties.

Thanks,

Jeff
Tucson, Arizona


 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      15th Oct 2006
Hello Jeff,
If you have to ask how then you don't want to do it. <g>
You can't do it using VBA. It is a Windows setting.
I believe there is some Windows API code out there that
will do it, but my advice is forget it.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Jeff Wright"
<(E-Mail Removed)>
wrote in message
Greetings all,
Is there a way of changing the color of the title bar on a user form? I
can't see any such attribute change under Properties.
Thanks,
Jeff
Tucson, Arizona


 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      15th Oct 2006
Even in Windows, you cannot change the color of just one titile bar, you
change the color of all title bars of all windows and user forms. You can
preview the effects in Control Panel>Appearance and
Themes>Display>Appearance>Advanced.

"Jim Cone" wrote:

> Hello Jeff,
> If you have to ask how then you don't want to do it. <g>
> You can't do it using VBA. It is a Windows setting.
> I believe there is some Windows API code out there that
> will do it, but my advice is forget it.
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware
>
>
>
> "Jeff Wright"
> <(E-Mail Removed)>
> wrote in message
> Greetings all,
> Is there a way of changing the color of the title bar on a user form? I
> can't see any such attribute change under Properties.
> Thanks,
> Jeff
> Tucson, Arizona
>
>
>

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      15th Oct 2006
Ok, I found some code here...
http://www.allapi.net/tips/tips2.shtml
It can change the color of the active window title bar.
You must change the color back when unloading the form.
If you just hide the form, then Excel title bar will be active
and it will reflect the new color. It worked for me.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html

'Proceed at your own risk!

This code goes at the top of a standard module...
Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long

This code goes in the userform module...
Private Const COLOR_SCROLLBAR = 0 'The Scrollbar colour
Private Const COLOR_BACKGROUND = 1 'Colour of the background with no wallpaper
Private Const COLOR_ACTIVECAPTION = 2 'Caption of Active Window
Private Const COLOR_INACTIVECAPTION = 3 'Caption of Inactive window
Private Const COLOR_MENU = 4 'Menu
Private Const COLOR_WINDOW = 5 'Windows background
Private Const COLOR_WINDOWFRAME = 6 'Window frame
Private Const COLOR_MENUTEXT = 7 'Window Text
Private Const COLOR_WINDOWTEXT = 8 '3D dark shadow (Win95)
Private Const COLOR_CAPTIONTEXT = 9 'Text in window caption
Private Const COLOR_ACTIVEBORDER = 10 'Border of active window
Private Const COLOR_INACTIVEBORDER = 11 'Border of inactive window
Private Const COLOR_APPWORKSPACE = 12 'Background of MDI desktop
Private Const COLOR_HIGHLIGHT = 13 'Selected item background
Private Const COLOR_HIGHLIGHTTEXT = 14 'Selected menu item
Private Const COLOR_BTNFACE = 15 'Button
Private Const COLOR_BTNSHADOW = 16 '3D shading of button
Private Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.
Private Const COLOR_BTNTEXT = 18 'Button text
Private Const COLOR_INACTIVECAPTIONTEXT = 19 'Text of inactive window
Private Const COLOR_BTNHIGHLIGHT = 20 '3D highlight of button

'Red
Private Sub UserForm_Activate()
Dim t As Long
t = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(255, 0, 0))
End Sub

'Dark Blue
Private Sub UserForm_Terminate()
Dim t As Long
t = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(51, 51, 153))
End Sub

 
Reply With Quote
 
Jeff Wright
Guest
Posts: n/a
 
      15th Oct 2006
Thanks, Jim. I guess I'll just forget it. I just thought there might be some
easy way to do it, which I couldn't find. I was just trying to spice up the
final version of my company spreadsheet.

Jeff


"Jim Cone" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
Ok, I found some code here...
http://www.allapi.net/tips/tips2.shtml
It can change the color of the active window title bar.
You must change the color back when unloading the form.
If you just hide the form, then Excel title bar will be active
and it will reflect the new color. It worked for me.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html

'Proceed at your own risk!

This code goes at the top of a standard module...
Declare Function SetSysColors Lib "user32" (ByVal nChanges As Long,
lpSysColor As Long, lpColorValues As Long) As Long

This code goes in the userform module...
Private Const COLOR_SCROLLBAR = 0 'The Scrollbar colour
Private Const COLOR_BACKGROUND = 1 'Colour of the background with no
wallpaper
Private Const COLOR_ACTIVECAPTION = 2 'Caption of Active Window
Private Const COLOR_INACTIVECAPTION = 3 'Caption of Inactive window
Private Const COLOR_MENU = 4 'Menu
Private Const COLOR_WINDOW = 5 'Windows background
Private Const COLOR_WINDOWFRAME = 6 'Window frame
Private Const COLOR_MENUTEXT = 7 'Window Text
Private Const COLOR_WINDOWTEXT = 8 '3D dark shadow (Win95)
Private Const COLOR_CAPTIONTEXT = 9 'Text in window caption
Private Const COLOR_ACTIVEBORDER = 10 'Border of active window
Private Const COLOR_INACTIVEBORDER = 11 'Border of inactive window
Private Const COLOR_APPWORKSPACE = 12 'Background of MDI desktop
Private Const COLOR_HIGHLIGHT = 13 'Selected item background
Private Const COLOR_HIGHLIGHTTEXT = 14 'Selected menu item
Private Const COLOR_BTNFACE = 15 'Button
Private Const COLOR_BTNSHADOW = 16 '3D shading of button
Private Const COLOR_GRAYTEXT = 17 'Grey text, of zero if dithering is used.
Private Const COLOR_BTNTEXT = 18 'Button text
Private Const COLOR_INACTIVECAPTIONTEXT = 19 'Text of inactive window
Private Const COLOR_BTNHIGHLIGHT = 20 '3D highlight of button

'Red
Private Sub UserForm_Activate()
Dim t As Long
t = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(255, 0, 0))
End Sub

'Dark Blue
Private Sub UserForm_Terminate()
Dim t As Long
t = SetSysColors(1, COLOR_ACTIVECAPTION, RGB(51, 51, 153))
End Sub


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Color of Caption in User form 2007 amit Microsoft Excel Programming 2 16th Apr 2008 12:43 AM
Change colour in title of user form =?Utf-8?B?SnVsZXM=?= Microsoft Word Document Management 0 14th Sep 2007 07:56 AM
title bar color does not change =?Utf-8?B?SXJpc2ggTWFmaWE=?= Windows XP Customization 1 15th Jul 2006 07:25 PM
How to change the color of a app's title bar? =?Utf-8?B?TWF0ZXVzeiBSYWpjYQ==?= Microsoft C# .NET 2 21st Dec 2005 04:44 PM
Re: How to change the color of the title bar in c#? jack Charbonneau Microsoft Dot NET Framework Forms 1 6th Aug 2003 05:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.