Application.Options.BlueScreen replacement idea

K

kbaxreno

I need a replacement for the Application.Options.BlueScreen that has been
removed in office 2007 word. I used this mode to indicate development
environment. We have a menu choice that flips the active system to dev
servers and databases. The bluescreen was great as a confirmation that we
were not on live system.
Is there some way to programatically change the look of 2007 word? Maybe
change the titlebar and menu background colors? This needs to be tied to the
Word application, not the current document as the open docs are often rapidly
changed and handed off to other processes.
Thanks
Ken
 
K

kbaxreno

Thanks Jay. Themes would probably work fine, but I need to set them
programatically. Do you have a link to some vba code? I don't find an
application.theme...

Ken
 
K

kbaxreno

Thanks Jay. I thought themes would have been perfect, but I have found they
do not run in compatibility mode. I have to use compatibility mode. So with
that in mind, how can I make a color change to the application rather than
the document?
Ken
 
J

Jay Freedman

Thanks Jay. I thought themes would have been perfect, but I have found they
do not run in compatibility mode. I have to use compatibility mode. So with
that in mind, how can I make a color change to the application rather than
the document?
Ken

I should have thought about this when you first asked about themes. I
don't think themes have any bearing on the issue.

First, let's clear a little Microsoft-caused confusion. Word has two
completely different things that are sometimes called themes:

- On the Page Layout tab of the ribbon, the Themes button on the left
end controls the application of "themes" that are sort of super-styles
consisting of a combination of fonts, font colors, and graphics
effects. This is the kind of theme I meant in my previous reply. But
this has *nothing* to do with the sort of BlueScreen replacement
you're interested in.

- In the Word Options > Popular dialog, there's a dropdown labeled
"Color scheme" with choices of Blue, Silver, and Black. This is what
changes the background colors of the ribbon and the area around the
page, and it's also sometimes called a "theme". This might do
something like what you want. But there is no access to change that
setting from a macro if that's what you need -- it's stored in the
registry of the current user profile, and changes only through the
Options dialog. It works the same in Compatibility Mode and native
mode.

Method 2 in the article
(http://blogs.msdn.com/microsoft_off...03/02/word-throwback-just-write-edition1.aspx)
doesn't have anything to do with themes, and most of it could be set
up through a macro if you need to do that.

I'm not clear on the criterion for when you want the appearance to
change. You said in your first post that it should be tied to the Word
application -- does that mean it's a function of the login profile, or
the machine where Word is running, or something else?
 
K

kbaxreno

Jay Freedman said:
I should have thought about this when you first asked about themes. I
don't think themes have any bearing on the issue.

First, let's clear a little Microsoft-caused confusion. Word has two
completely different things that are sometimes called themes:

- On the Page Layout tab of the ribbon, the Themes button on the left
end controls the application of "themes" that are sort of super-styles
consisting of a combination of fonts, font colors, and graphics
effects. This is the kind of theme I meant in my previous reply. But
this has *nothing* to do with the sort of BlueScreen replacement
you're interested in.

- In the Word Options > Popular dialog, there's a dropdown labeled
"Color scheme" with choices of Blue, Silver, and Black. This is what
changes the background colors of the ribbon and the area around the
page, and it's also sometimes called a "theme". This might do
something like what you want. But there is no access to change that
setting from a macro if that's what you need -- it's stored in the
registry of the current user profile, and changes only through the
Options dialog. It works the same in Compatibility Mode and native
mode.

Method 2 in the article
(http://blogs.msdn.com/microsoft_off...03/02/word-throwback-just-write-edition1.aspx)
doesn't have anything to do with themes, and most of it could be set
up through a macro if you need to do that.

I'm not clear on the criterion for when you want the appearance to
change. You said in your first post that it should be tied to the Word
application -- does that mean it's a function of the login profile, or
the machine where Word is running, or something else?

I will look closer at that article. I did not see any VBA my first time
through.
We have a fairly large Word application - about 60 templates and thousands
of lines of code - that control the editing, storage, history, format,
dispersion and just about anything you can think of for legal documents.
Every (EVERY) keystroke is evaluated. Every word, paragraph, section,
subsection... is stored in SQL.
The situation for using the old bluescreen was to indicate debugging or
development mode. When one of us programmers or one of the techs need to do
a little end user debugging they use a password protected button to switch
all databases to development mode and allow overrule of most edit checks.
They would make a change to the document and then switch back to live mode
and the user would resume their work. The normal use of the application has
many documents opening and closing, so I need the "development indicator"
tied to Word and not to an open document.
The bluescreen switch did this perfectly.
This development mode is indicated in a registry key and read by an autoexec
template module so if Word is shutdown and restarted it will start in the
last mode.
 
J

Jay Freedman

I will look closer at that article. I did not see any VBA my first time
through.
We have a fairly large Word application - about 60 templates and thousands
of lines of code - that control the editing, storage, history, format,
dispersion and just about anything you can think of for legal documents.
Every (EVERY) keystroke is evaluated. Every word, paragraph, section,
subsection... is stored in SQL.
The situation for using the old bluescreen was to indicate debugging or
development mode. When one of us programmers or one of the techs need to do
a little end user debugging they use a password protected button to switch
all databases to development mode and allow overrule of most edit checks.
They would make a change to the document and then switch back to live mode
and the user would resume their work. The normal use of the application has
many documents opening and closing, so I need the "development indicator"
tied to Word and not to an open document.
The bluescreen switch did this perfectly.
This development mode is indicated in a registry key and read by an autoexec
template module so if Word is shutdown and restarted it will start in the
last mode.

I didn't say the article had VBA, just that the things it described
could be done in a macro.

This set of procedures, saved in each developer's Normal.dotm template
(or a global template stored in theWord Startup folder) and suitably
modified, should do something close to the old blue screen.

If you already have AutoOpen and/or AutoNew macros (or the equivalent
event handlers, Document_Open and Document_New in the ThisDocument
module), just add the call to ToggleBlueScreen to the existing code.

Each time the developer opens an existing document or creates a new
one, the ToggleBlueScreen procedure will be called. It reads the
registry key (modify this to read the same key used by your autoexec
macro, and interpret whatever values you're assigning to that key),
and then it calls one of the two private procedures to change the page
color.

The code assumes that the text in the documents is formatted with font
color = Automatic. When the background is set to blue (or any color
that's dark enough), the display text automatically switches from
black to white. This doesn't affect the font color stored in the
document or used for printing.

The fiddling with the .Saved property prevents the color change from
causing a spurious save prompt when a document is closed; but if the
document already had changes that needed saving, that won't be
dropped.

The ForceToggle procedure was mainly for me to see the effect easily.
For your setup, just add the just add the call to ToggleBlueScreen to
the existing code that lets the developers switch into and out of
debugging mode.

Sub AutoOpen()
ToggleBlueScreen
End Sub

Sub AutoNew()
ToggleBlueScreen
End Sub

Sub ToggleBlueScreen()
Dim regEntry As String
' modify as needed for your existing registry entry
regEntry = System.PrivateProfileString("", _
"HKEY_CURRENT_USER\Software\Microsoft\Office", _
"DebugMode")

If LCase(regEntry) = "true" Then
SetBlueScreen
Else
SetNormalScreen
End If
End Sub

Private Sub SetBlueScreen()
Dim oDoc As Document
Dim bWasClean As Boolean

For Each oDoc In Documents
With oDoc
bWasClean = .Saved
.Background.Fill.ForeColor.RGB = RGB(0, 0, 255)
.Background.Fill.Visible = msoTrue
.Saved = bWasClean
End With
Next oDoc
End Sub

Private Sub SetNormalScreen()
Dim oDoc As Document
Dim bWasClean As Boolean

For Each oDoc In Documents
With oDoc
bWasClean = .Saved
.Background.Fill.ForeColor.RGB = RGB(255, 255, 255)
.Background.Fill.Visible = msoTrue
.Saved = bWasClean
End With
Next oDoc
End Sub

Sub ForceToggle()
Dim regEntry As String
regEntry = System.PrivateProfileString("", _
"HKEY_CURRENT_USER\Software\Microsoft\Office", _
"DebugMode")
If LCase(regEntry) = "true" Then
System.PrivateProfileString("", _
"HKEY_CURRENT_USER\Software\Microsoft\Office", _
"DebugMode") = "false"
Else
System.PrivateProfileString("", _
"HKEY_CURRENT_USER\Software\Microsoft\Office", _
"DebugMode") = "true"
End If
ToggleBlueScreen
End Sub
 
K

kbaxreno

I think I can use your example Jay. Thanks. I'm glad you picked up on the
..saved status, and not saving the color change with the document was also a
must have. Now I just have to integrate it into the hundreds of instances
where a new doc opens.

Thanks again.
Ken
 

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