Re: X is the issue to this macro



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



.



Relevant Pages

  • Re: Search for paragraph, format, & continue this through rest of docu
    ... the word "KeepTogetherTag" as the beginning of the paragraph and the word ... Once I select and format the first paragraph, ... ' Search document for the word KeepTogetherTag ... .MatchWholeWord = False ...
    (microsoft.public.word.vba.general)
  • Re: Importing Word text into Excel
    ... .Format = False ... .MatchWholeWord = False ... The paragraphs (actually lines because there is a paragraph ... "macropod" wrote: ...
    (microsoft.public.excel.programming)
  • Re: Search for paragraph, format, & continue this through rest of
    ... The reason my document has the "KeepTogetherTag" as the beginning of the ... paragraph and the "KeepTogetherTag1" as the end of the paragraph is ... the tags and format this paragraph to "Keep with Next". ... .MatchWholeWord = False ...
    (microsoft.public.word.vba.general)
  • Re: Search for paragraph, format, & continue this through rest of
    ... The reason my document has the "KeepTogetherTag" as the beginning of the ... paragraph and the "KeepTogetherTag1" as the end of the paragraph is because ... the tags and format this paragraph to "Keep with Next". ... .MatchWholeWord = False ...
    (microsoft.public.word.vba.general)
  • RE: X is the issue to this macro
    ... In Word a paragraph is a series of text which ends in a paragraph mark. ... paragraphs with a particular format. ... a discription in uppercase ... .MatchWholeWord = False ...
    (microsoft.public.word.vba.general)