Re: X is the issue to this macro
- From: Steved <Steved@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 19 Aug 2008 15:53:01 -0700
Hello Doug
I've now have my issue resolved and I thankyou.
Steved
"Doug Robbins - Word MVP" wrote:
Also, what separates the DIAMOND and SATIN from the X4?.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"StevenM" <stevencraigmiller(at)comcast(dot)net> wrote in message
news:9CF2479A-BFCC-43F9-80FA-6F285533AA0E@xxxxxxxxxxxxxxxx
To: Steved,
Are you for sure using Find is the best way of going about this? I think
that if we had a better discription of your document, we might be able to
come up with a better way of solving your problem.
8 IRISH DIAMOND X4 68534
13 SILK N SATIN X4 68534
In Word a paragraph is a series of text which ends in a paragraph mark.
Often lines like those of yours above come as seperate paragraphs. So that
each line is a paragraph. If so, perhaps we can search paragraphs looking
for
paragraphs with a particular format.
What type of font is being used? If it is a monospaced font, then we might
be able to determine the length of each line, and the position of each
item
on the line.
In the above example, it appears we have four columns.
Column 1: a number (perhaps one or two digits)
Column 2: a discription in uppercase (followed by flexible space)
Column 3: a two character code
Column 4: a five digit number (or five character code)
Is this correct?
Steven Craig Miller
"Steved" wrote:
Hello from Steved
8 IRISH DIAMOND 4 68X534
13 SILK N SATIN 055
The below macro will highlite 8 IRISH DIAMOND and 13 SILK N SATIN
8 IRISH DIAMOND X4 68534
13 SILK N SATIN X4 68534
The below macro will highlite 8 IRISH DIAMOND X4 68534 and
13
SILK N SATIN X4 68534
With the below macro how can I make it highlite "8 IRISH DIAMOND" and "13
SILK N SATIN" not '8 IRISH DIAMOND X4 68534" and "13 SILK
N
SATIN X4 68534"
The issue is the X
Sub Highliter()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[0-9 ]{1,}[A-Z ]{1,}"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[A-Z ]@>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
ActiveDocument.Save
Selection.Font.Color = wdColorRed
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow
Selection.HomeKey Unit:=wdLine
End Sub
Thankyou
- References:
- X is the issue to this macro
- From: Steved
- RE: X is the issue to this macro
- From: StevenM
- Re: X is the issue to this macro
- From: Doug Robbins - Word MVP
- X is the issue to this macro
- Prev by Date: RE: X is the issue to this macro
- Next by Date: Re: STYLEREF in header
- Previous by thread: Re: X is the issue to this macro
- Next by thread: Extract header and footer and place into body?
- Index(es):
Relevant Pages
|