#1   Report Post  
Posted to microsoft.public.word.docmanagement
D Wood D Wood is offline
external usenet poster
 
Posts: 2
Default Email filter

I have a 50 page word doc converted from pdf that has 1 email address per
page. Is it possible to filter/capture only email addresses at once instead
of copying and pasting from each page?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Email filter

On Mon, 8 Mar 2010 17:50:01 -0800, D Wood
wrote:

I have a 50 page word doc converted from pdf that has 1 email address per
page. Is it possible to filter/capture only email addresses at once instead
of copying and pasting from each page?


Yes, it's possible, by using a wildcard search in a macro. Wildcards
are explained in http://www.gmayor.com/replace_using_wildcards.htm.

The following macro will find the email addresses (that is, any
sequence of letters, numbers, and periods on both sides of an @
symbol) and copy them into a new document, one per paragraph. See
http://www.gmayor.com/installing_macro.htm if needed.

Sub CollectEmailAddresses()
Dim srcDoc As Document, dstDoc As Document
Dim oRg As Range

Set srcDoc = ActiveDocument
Set dstDoc = Documents.Add
Set oRg = srcDoc.Range

With oRg.Find
.MatchWildcards = True
.Text = "[A-Za-z0-9.]{1,}\@[A-Za-z0-9.]{1,}"
.Wrap = wdFindStop
While .Execute
dstDoc.Range.InsertAfter oRg.Text & vbCr
Wend
End With
End Sub


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Email filter

On Mon, 8 Mar 2010 17:50:01 -0800, D Wood
wrote:

I have a 50 page word doc converted from pdf that has 1 email address per
page. Is it possible to filter/capture only email addresses at once instead
of copying and pasting from each page?


Yes, it's possible, by using a wildcard search in a macro. Wildcards
are explained in http://www.gmayor.com/replace_using_wildcards.htm.

The following macro will find the email addresses (that is, any
sequence of letters, numbers, and periods on both sides of an @
symbol) and copy them into a new document, one per paragraph. See
http://www.gmayor.com/installing_macro.htm if needed.

Sub CollectEmailAddresses()
Dim srcDoc As Document, dstDoc As Document
Dim oRg As Range

Set srcDoc = ActiveDocument
Set dstDoc = Documents.Add
Set oRg = srcDoc.Range

With oRg.Find
.MatchWildcards = True
.Text = "[A-Za-z0-9.]{1,}\@[A-Za-z0-9.]{1,}"
.Wrap = wdFindStop
While .Execute
dstDoc.Range.InsertAfter oRg.Text & vbCr
Wend
End With
End Sub


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Email filter

Macro to extract all of the email addresses from a document

Sub CopyAddressesToOtherDoc()
Dim Source As Document, Target As Document, myRange As Range
Set Source = ActiveDocument
Set Target = Documents.Add
Application.ScreenUpdating = False
Source.Activate
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="[+0-9A-z._-]{1,}\@[A-z.]{1,}", _
MatchWildcards:=True, Wrap:=wdFindStop, Forward:=True) = True
Set myRange = Selection.Range
Target.Range.InsertAfter myRange & vbCr
Loop
End With
Selection.HomeKey Unit:=wdStory
Target.Activate
End Sub


--
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, originally posted via msnews.microsoft.com

"D Wood" wrote in message
...
I have a 50 page word doc converted from pdf that has 1 email address per
page. Is it possible to filter/capture only email addresses at once
instead
of copying and pasting from each page?


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Email filter

Macro to extract all of the email addresses from a document

Sub CopyAddressesToOtherDoc()
Dim Source As Document, Target As Document, myRange As Range
Set Source = ActiveDocument
Set Target = Documents.Add
Application.ScreenUpdating = False
Source.Activate
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="[+0-9A-z._-]{1,}\@[A-z.]{1,}", _
MatchWildcards:=True, Wrap:=wdFindStop, Forward:=True) = True
Set myRange = Selection.Range
Target.Range.InsertAfter myRange & vbCr
Loop
End With
Selection.HomeKey Unit:=wdStory
Target.Activate
End Sub


--
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, originally posted via msnews.microsoft.com

"D Wood" wrote in message
...
I have a 50 page word doc converted from pdf that has 1 email address per
page. Is it possible to filter/capture only email addresses at once
instead
of copying and pasting from each page?


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Works Filter dawnvk Microsoft Word Help 1 October 22nd 09 12:22 PM
Filter Jackieblue Tables 5 October 30th 07 04:02 PM
filter keys Kathleen Microsoft Word Help 3 January 30th 07 10:48 PM
How do I filter a document in WORD to show only email addresses? PEG Microsoft Word Help 1 June 15th 06 11:06 PM
Filter Key DSFCPAS Microsoft Word Help 1 June 2nd 05 05:38 PM


All times are GMT +1. The time now is 03:11 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"