[mso] Re: Highlight lines in Word (2000) through entire document? Yep...
- From: "Jim Pettit" <jimpettit@xxxxxxxxx>
- To: <mso@xxxxxxxxxxxxx>
- Date: Thu, 28 Feb 2008 08:39:48 -0500
All--
I wrote a couple of quick and dirty little VBA subroutines to accomplish
most of what you want. The first works to highlight rows based on a
predefined spacing (determined by changing the number assigned to the
variable iHighlightSpacing in the third row). Just create a couple of
macros, assign them to a button, and hit that button when you want to
highlight/unhighlight:
--------------------------------------------------------
Sub subHighlightRows()
On Error Resume Next
Dim iHighlightSpacing As Integer
iHighlightSpacing = 3
Dim oPages As Pages
Set oPages = ActiveDocument.ActiveWindow.Panes(1).Pages
Dim oLines As Lines
Dim iPageCount As Integer
Dim iLineCount As Integer
For iPageCount = 1 To oPages.Count
Set oLines =
ActiveDocument.ActiveWindow.Panes(1).Pages(iPageCount).Rectangles(1).Lines
For iLineCount = iHighlightSpacing To oLines.Count Step
iHighlightSpacing
Set oLine = oLines(iLineCount)
oLine.Range.HighlightColorIndex = wdYellow
Next iLineCount
Next iPageCount
End Sub
--------------------------------------------------------
This second routine can be used to kill all highlighting:
--------------------------------------------------------
Sub subUnHighlightAllRows()
On Error Resume Next
Dim oPages As Pages
Set oPages = ActiveDocument.ActiveWindow.Panes(1).Pages
Dim oLines As Lines
Dim iPageCount As Integer
Dim iLineCount As Integer
For iPageCount = 1 To oPages.Count
Set oLines =
ActiveDocument.ActiveWindow.Panes(1).Pages(iPageCount).Rectangles(1).Lines
For iLineCount = 1 To oLines.Count
Set oLine = oLines(iLineCount)
oLine.Range.HighlightColorIndex = wdNone
Next iLineCount
Next iPageCount
End Sub
--------------------------------------------------------
Couple of other notes: this code works in Word 2003 and Word 2007; I don't
have a copy of Word 2000 in which to test it, and I'm not familiar enough
with the Word object model to promise that it will or won't work with that
version.
Hope this helps...
--Jim
-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf
Of Robert Carneal USA
Sent: Wednesday, February 27, 2008 3:50 PM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Highlight lines in Word (2000) through entire document?
Hello. When I search for _*Highlight Lines In Word 2000*_, most of my
hits are for Excel, which explains how to highlight rows. In this case,
I would like to make every third line highlight simply for easier
reading. Can this be done for an entire document in Word 2000 without
having to do it manually for 37 pages?
Thanks.
Robert
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.1/1302 - Release Date: 2/27/2008
4:34 PM
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx
To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
To Unsubscribe from this group, visit the group's homepage and use the dropdown
menu at the top. This will allow you to unsubscribe your email address or
change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso
To be able to share files with the group, you must join our Yahoo sister group.
This group will not allow for posting of emails, but will allow you to join
and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE
SHARING ONLY.
If you are using Outlook and you see a lot of unnecessary code in your email
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************
- References:
- [mso] Highlight lines in Word (2000) through entire document?
- From: Robert Carneal USA
Other related posts:
- » [mso] Re: Highlight lines in Word (2000) through entire document? Yep...
- [mso] Highlight lines in Word (2000) through entire document?
- From: Robert Carneal USA