Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

Hidden Text toggle

149 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Dawn Rhoads

ungelesen,
09.05.2003, 13:12:0109.05.03
an
Two problems. First, I'm looking for a way to toggle the
settings in my Tools/Options area regarding Hidden Text.
I want toggle on and off tools/options/view/hidden text
and tools/options/print/hidden text.

I want these settings to be for every document a person is
working on. Not just the current document.

I can get the printing hidden text to toggle, so it will
always print hidden text. But the view.showhiddentext
command seems to make me specify the active document. I
tried deleting the reference to the active document and
active window, and got an error "method or data member not
found."

The second problem relates to the toolbar button for the
macro. I can get it assigned to a button just fine, but I
would like it to appear to "depress", similar to for
instance the "bold" button, so the user can tell at a
glance whether they're on or off. The button I make just
runs the macro, but then I can't tell which status I'm at.

Any thoughts on either part of the problem will be very
appreciated!

Here's the code I have now:


ActiveDocument.ActiveWindow.View.ShowHiddenText = _
Not ActiveDocument.ActiveWindow.View.ShowHiddenText

Options.PrintHiddenText = _
Not Options.PrintHiddenText

JGM

ungelesen,
09.05.2003, 14:41:3709.05.03
an
Hi Dawn,

For displaying hidden text in all currently opened Word windows, use/adapt
the following code. For the "depressed" effect, I think that this is a
special effect wired in the Word binary file that we cannot reproduce. I
remember asking the same question and being told that basically it was
better to forget about it (I hope I am wrong because I would like to know as
well how to do that!). But that does not mean that you cannot do something
visual for your users. I have included code that changes the button caption
to tell the user the current state of hidden text display. Notice also that
I included a tool tip text and that I added the ShowAll line to make sure
that it was turned off otherwise if it is on, regardless of the Tools \
Options \ Display hidden text setting, hidden text is always shown (that is
why it is called "Show All" ;-) ). All you need to do is create a tool bar
(Tools \ Customize) and to call it "Hidden Text" (without the quotes) and to
add a button linked to the macro. Don't worry about the caption, it will
change as soon as you use it the first time. Also, put all this (Code and
Toolbar) in a *.dot file called "Toggle Hidden text.dot" (or call it
whatever, but adjust the code) and put it in the Word start up folder. All
the code in the procedure that has to do with attached templates and
customization is to avoid doing changes to the Normal .dot file, which is
highly recommended. If you like living dangerously and don't care about
changing the Normal.dot, remove all the line from Dim myTemplate to
CustomizationContext. and the last two lines.

Sub Toggle_Hidden_Text()

Dim MyWin As Window
Dim myTemplate As String
Dim GlobalPath

Dim ShowHidden As Boolean


myTemplate = ActiveDocument.AttachedTemplate
GlobalPath = Options.DefaultFilePath(Path:=wdStartupPath)

ActiveDocument.AttachedTemplate = GlobalPath & "\Toggle Hidden text.dot"

CustomizationContext = ActiveDocument.AttachedTemplate


For Each MyWin In Application.Windows
If MyWin.View.ShowHiddenText = True Then
ShowHidden = False
With MyWin.View
.ShowHiddenText = False
.ShowAll = False
End With
With Application.CommandBars("Hidden Text").Controls(1)
.Caption = "Hidden text: No"
.TooltipText = "Click to display hidden text"
End With
Else
ShowHidden = True
With MyWin.View
.ShowHiddenText = True
.ShowAll = False
End With
With Application.CommandBars("Hidden Text").Controls(1)
.Caption = "Hidden text: Yes"
.TooltipText = "Click to stop displaying hidden text"
End With
End If
Next MyWin

If ShowHidden Then
Options.PrintHiddenText = True
Else
Options.PrintHiddenText = False
End If

ActiveDocument.AttachedTemplate.Save

ActiveDocument.AttachedTemplate = myTemplate

End Sub

HTH
Cheers!

--
_________________________________________

Jean-Guy Marcil
proje...@sympatico.ca

"Dawn Rhoads" <dawn....@klarquist.com> a écrit dans le message de
news:047f01c3164e$1ad717f0$3401...@phx.gbl...

JGM

ungelesen,
09.05.2003, 14:46:0309.05.03
an
Sorry, small mistake in my previous post:

> changing the Normal.dot, remove all the line from Dim myTemplate to
> CustomizationContext. and the last two lines.

except for the
Dim ShowHidden As Boolean
line!

Anyway, I am sure you would have figured it out!

Bye
--
_________________________________________

Jean-Guy Marcil
proje...@sympatico.ca

"JGM" <no-...@leaveme.alone> a écrit dans le message de
news:e65xIqlF...@tk2msftngp13.phx.gbl...

Dawn Rhoads

ungelesen,
20.05.2003, 14:42:0220.05.03
an
Jean-Guy -- Hi! Been testing this out, and it works
great, thanks so much! (Sorry I haven't posted sooner)

I haven't seen any other posts on how to get a button to
behave like the buttons built into Word, so that it will
appear to be depressed, but your solution with the text
works just dandy!

I am now also looking for a similar idea, but just for one
document at a time, not every open document. I'm going to
post that separately since I started this thread so long
ago, but just wanted to post and say thanks so much for
you help on this!

>.
>

0 neue Nachrichten