Changing the color of a user form

T

Theo van der Ster

I just changed the background color of my user forms (dialog boxes)
like so:

Me.BackColor = RGB(231, 244, 255)

That works fine but it doesn't do anything for the user forms that have
pages. I tried:

MultiPage1.BackColor = RGB(231, 244, 255)

and that works too but only for the small strip of color behind the
pages. The pages themselves remain a dull grey. Is there any way to
change their color? I don't see anything in the properties but I cannot
imagine that this isn't possible if you can change the color of every
other control on the form.

Any ideas are very welcome,
Thanks in advance,
Theo
 
V

Vince

Theo,

Try this:

On Error Resume Next

Dim CTRL As Control
Dim i As Integer

For i = 1 To YourForm.MultiPage1.Pages.count
For Each CTRL In YourForm.MultiPage1.Pages(i).Controls

CTRL.BackColor = &HC0FFC0 ' OR WHATEVER
Next
Next

This will change the color of the page as well as all other controls on it
to the color you desire. You can, however, not change the color of the tab
(as far as I know). You could modify the code above so that it only does the
backcolor of the page or all the controls on the page thereof.

Vince
 
T

Theo van der Ster

Thanks, Vince.

You're right. There seems to be no way to change the color of the tab
itself. Actually, the For loop changes only the labels and leaves the
buttons and check boxes untouched, a bit like a bad paint job.

It's really strange that this should be so. I guess I have no other
option than to change the color of all my user forms back to grey
because it looks awful if everything is one color and the pages still
look grey. It's a shame but then again it's just cosmetics.

Thanks for your help, anyway.
Theo
 
V

Vince

Well, yeah, it does look like a bad paint job. You can actually change the
color of the buttons, though. You'll just have to ensure that the style
property of the buttons is Graphics. Changing the color of the checkbox (the
small white box) is probably next to impossible or just isn't worth the
effort.

My VBA application also uses the usual grey color and no prizes for guessing
why!

Vince
 
T

Theo van der Ster

It's a mystery to me why Microsoft makes this impossible, but my only
remedy is to go back to the default color. Maybe they don't want their
users' dialogs to look cooler than theirs. To be sure, MS's dialogs
could use a little touch-up: a bit of lipstick here, a little rouge
there...

Theo
 
V

Vince

Yup, I think this is an X-File. Maybe Uncle Bill wants to make sure that
Windows retains its Windows color!

Well, I recently checked out the Mac OSX and it's truly amazing. The dialogs
are colorful but not gaudy. Perfect combination of simplicity, elegance and
the right amount of color. The animation is also good. Maybe M$ will change
the dialogs in their Longhorn version. Another X-file - Why is Longhorn so
called and why is Active X called Active X? What the heck is 'X' in 'Active
X' (an X-file ??)

Vince
 
T

Theo van der Ster

Uncle Bill ... he, he
Oh well, back to the grey ol' world of MS.

The X is for making it look interesting. They do that a lot in the IT
industry.
 
J

Jay Freedman

According to Paul Thurrott's site
http://www.winsupersite.com/faq/longhorn.asp,

"As I first revealed, the Longhorn name wasn't chosen randomly.
Remember that Windows XP was code-named Whistler and the next version
of Windows, at the time, was code-named Blackcomb. Both of these names
come from ski areas in British Columbia, close to Microsoft's
headquarters. At the foot of Whistler Mountain, there is a saloon
named Longhorn that serves the local skiing population. So if you're
ever in the area and want to take in some local color, Longhorn is a
nice stop… after you're done with Whistler."

I couldn't find anything definitive about the origin of the "ActiveX"
term, but I suspect it was dreamed up by somebody in the Marketing
department when Microsoft was trying to repackage OLE and COM as a
competitor for Java (http://en.wikipedia.org/wiki/ActiveX).
 
V

Vince

Very interesting. We'll just have to take a tour around Redmond to guess
future code names.

Vince
 
J

Jean-Guy Marcil

Vince was telling us:
Vince nous racontait que :
Very interesting. We'll just have to take a tour around Redmond to
guess future code names.

It's going to be a heck of a tour
Whistler (and its Longhorn Saloon) is about 3-4 hours away from Redmond
across the border...

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
H

Howard Kaikow

Theo van der Ster said:
Thanks, Vince.

You're right. There seems to be no way to change the color of the tab
itself. Actually, the For loop changes only the labels and leaves the
buttons and check boxes untouched, a bit like a bad paint job.

It's really strange that this should be so. I guess I have no other
option than to change the color of all my user forms back to grey
because it looks awful if everything is one color and the pages still
look grey. It's a shame but then again it's just cosmetics.

Thanks for your help, anyway.
Theo

A Client asked me a similar question a few years ago.
My answer was something like the following.

"No, Yes, and you likely do not want to touch this.



VBA has no way to do this.

You can use VBA to make an API call to change the color of the title bar,
but .

It is too early for you to get involved with API calls and, in this
particular case, you may not want to anyway because when you change the
SYSTEM color for the title bar, that gets used by ALL windows for all apps
unless you reboot, or change it back in code."
 
T

Theo van der Ster

Thanks Howard, and sorry because I'm reading your post 4 weeks after
you mailed it. Anyway, I've discarded the whole idea. It would have
been nice to change the color to make my dialogs different from Word's
dialogs but it's not terribly important as the functionality doesn't
depend on it.

Theo
 

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