Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Find double lines - vba or wildcards?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nomey - 29 Aug 2006 11:08 GMT
I'm trying to find all double (identical subsequent) lines in a Word-file. This is the file structure:

Saturday, Bob and Mary, 02 PM
Sunday, Bob and Raymond, 02 PM
Sunday, Bob and Raymond, 02 PM
Monday, Joan and Priscilla, 01 PM

Now, I have been trying to find all double lines with this wildcard search:

(^13*^13)@

but no double lines are found. What wildcard combination would I need to accomplish this search? Is it necessary to use vba? (Word 2002 SP3)

S. Nomey
Jezebel - 29 Aug 2006 11:33 GMT
You might find it easier to paste the file into Excel and do the checking
there.

> I'm trying to find all double (identical subsequent) lines in a Word-file.
> This is the file structure:
[quoted text clipped - 13 lines]
>
> S. Nomey
Nomey - 29 Aug 2006 11:54 GMT
No, not in this case. There are more lines than Excel can handle.

Shirley.

> You might find it easier to paste the file into Excel and do the checking
> there.
[quoted text clipped - 16 lines]
>>
>> S. Nomey
Jezebel - 29 Aug 2006 11:58 GMT
More than 65000?

> No, not in this case. There are more lines than Excel can handle.
>
[quoted text clipped - 20 lines]
>>>
>>> S. Nomey
Nomey - 29 Aug 2006 13:21 GMT
Yes, I can't help it.

> More than 65000?
>
[quoted text clipped - 22 lines]
>>>>
>>>> S. Nomey
Greg Maxey - 29 Aug 2006 13:24 GMT
See:
http://gregmaxey.mvps.org/Sort_and_Delete_Duplicates.htm

As your list is probably already sorted, you will want to stet out the
part of the code that sorts the list.

> No, not in this case. There are more lines than Excel can handle.
>
[quoted text clipped - 20 lines]
> >>
> >> S. Nomey
Doug Robbins - Word MVP - 29 Aug 2006 12:22 GMT
See the article "Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm

Signature

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

> I'm trying to find all double (identical subsequent) lines in a Word-file.
> This is the file structure:
[quoted text clipped - 13 lines]
>
> S. Nomey
Tony Jollans - 29 Aug 2006 12:57 GMT
Find and Replace doesn't work that way; you will need VBA.

Some simple code might be ...

For Each para In ActiveDocument.Paragraphs
   If para.Range.Text = para.Next.Range.Text Then
       MsgBox para.Range.Text & "duplicated"
   End If
Next

This will error out on the last paragraph; it could obviously be changed to
avoid or trap the error.

--
Enjoy,
Tony

> I'm trying to find all double (identical subsequent) lines in a Word-file. This is the file structure:
>
[quoted text clipped - 10 lines]
>
> S. Nomey
Nomey - 29 Aug 2006 13:25 GMT
Thanks, Tony.

I've found a way to do it without vba too:

(*^13){2}

but this works rather slow on large files.

Cheers
Shirly

> Find and Replace doesn't work that way; you will need VBA.
>
[quoted text clipped - 27 lines]
> accomplish this search? Is it necessary to use vba? (Word 2002 SP3)
>> S. Nomey
Tony Jollans - 29 Aug 2006 14:05 GMT
I stand corrected; my apologies.

--
Enjoy,
Tony

> Thanks, Tony.
>
[quoted text clipped - 38 lines]
> > accomplish this search? Is it necessary to use vba? (Word 2002 SP3)
> >> S. Nomey
Nomey - 29 Aug 2006 14:22 GMT
No need to apologize, really. I thank everybody for their solutions. I think I'll manage to delete all duplicates thanks to your contributions.

Kind regards,
S.

> I stand corrected; my apologies.
>
[quoted text clipped - 47 lines]
>>> accomplish this search? Is it necessary to use vba? (Word 2002 SP3)
>>>> S. Nomey
Helmut Weber - 29 Aug 2006 14:30 GMT
Hi Nomey,

to me it seems a file of that kind,
needn't be a Word-file at all.
It's just an array of strings,
from which as long as string(x) = string (x+1)
string(x+1) should be deleted.
Not quite simple, though.

Or you could treat your source as a textfile,
read line(x) and line(x+1)
compare them, and
if they are equal, write only
the first of them to a new text file,
otherwise write both.
Not quite that simple either.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Graham Mayor - 29 Aug 2006 14:04 GMT
Really?

(*^13)@
wildcard replace with
\1
will work assuming the lines are each separated with a paragraph mark and
are sorted first.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Find and Replace doesn't work that way; you will need VBA.
>
[quoted text clipped - 27 lines]
>>
>> S. Nomey
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.