Find and Insert not Replace

C

Connie

I have an address list that I am creating a macro in. At
first, all names included a Social Security Number. I
used the Find SSN and Replace with a paragraph mark.

Now, I've run across a name and address that does not
include the SSN.

Is there a way to find "State" "Zip Code" and IF "SSN"
does not appear after the "Zip Code" Insert and Special
Character in between the "Zip Code" and the next name on
the list?
 
C

Connie

Thanks for your reply. I'm attaching both the mailing
list I'm working on in addition to my notes of the key
strokes. I'm not sure how to send the actual macro to
you. Hope you can help.

Thanks again,
Connie

Note: I had to send my docs to you via your e-mail
because I couldn't insert them here. Hope you got them.
 
Y

YoungHwan Park

you doc not in my Inbox,
Send it again pls.
Thank you.
(e-mail address removed)
 
C

Connie

Teresa Renee Fuller
2100 F Dornbin Drive
Reynoldsburg, OH 43068
SSN: xxx-xx-1432
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411
Anthony D Phillips
1202 Cattail Road
Chillicothe, OH 45601
SSN: xxx-xx-3026
Karen Phillips
1202 Cattail Road
Chillicothe, OH 45601
SSN: xxx-xx-1612
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411
Michelle Santucci Scott
1308 Hideaway Woods
Westerville, OH 43081
SSN: xxx-xx-0904
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411
Theodore M Ahrens
7858 Rock Hollow Ln
Malta, OH 43758
Eleanor D Ahrens
7858 Rock Hollow Ln
Malta, OH 43758
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411

Scanner Macro

Keyboard strokes: Ctrl S

Recorded within this Macro:

Edit; Find; More; Special, Paragraph Mark (^p); Replace;
Replace with, Special, Nonbreaking Space (^s); Replace
All; OK.

Find what: manually typed in: SSN: ***-**-***^s (note:
after typing in SSN: ***-**-**** selected Special in order
to add Nonbreaking Space (^s).); Replace with: Special,
Paragraph Mark (^p); click ý Use Wildcards; Replace All;
OK.

Unclick ¨ Use Wildcards; Find what: Special, Any Digit
(^#^#^#-^#^#^#-^#^#^#^#), Special, Nonbreaking Space (^s);
Replace with: Special, Paragraph Mark (^p); Replace All;
OK.

Find what: Special, Nonbreaking Space (^s), Special,
Paragraph Mark (^p); Replace with: Special, Paragraph Mark
(^p); Replace All; OK.

Find what: Special, Nonbreaking Space (^s), manually typed
in: (, Special, Paragraph Mark (^p); Replace with:
Special, Paragraph Mark (^p); Replace All, OK.

Find what: manually pressed space bar one time, Special,
Paragraph Mark (^p); Replace with: Special, Paragraph
Mark (^p); Replace All; OK.

Find what: Special, Nonbreaking Space (^s); Replace
with: Special, Tab Character (^t); Replace All; OK.

Find what: manually pressed space bar one time, Special,
Tab Character (^t); Replace with: Special, Tab Character
(^t); Replace All; OK; Replace All; OK; Replace All; OK.

ý Exited out of Find and Replace Menu.

File; Page Set-up; switched to Landscape.

End Macro: Scanner

At this point, make sure that under Tools, Options, View,
Formatting Marks, ý All, is selected. This way you can
view where in the document you may need to make manual
changes (i.e. The above macro will automatically format
the names and addresses to appear exactly the same as from
the scanned page (example: 558 Madison Avenue, Apt 1 will
appear on two lines as there is a tab "à" mark between Apt
and 1. You will need to delete the tab "à" mark in order
for the full address to appear on one line. Do you want
the name to appear as First and Last separately, then need
to insert a tab "à" mark between first and last name.)
Just keep in mind a new column will be created in the next
macro (ScanContinue) every place you see a tab "à" mark.

ScanContinue Macro

Keyboard strokes: Ctrl C



This Macro will place Names and Address in a Table Form.

Recorded within this Macro:

Ctrl-Home

Edit; Select All

Table; Insert; Table; Ctrl-Home

Table; Insert; Rows Above; Ctrl-Home

Manually Typed in: Name; press table key
Manually Typed in: Address 1; press table key
Manually Typed in: Address 2; press table key
Manually Typed in: Address 3; press table key

End Macro: ScanContinue

Need to Save document in order to do Mail Merge. It is
very important at this time to save file as a Word
Document.
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi Connie,

The following macro should do what you want:

Dim mydoc As Document
Set mydoc = ActiveDocument
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Execute FindText:="(OH )([0-9)]{5})^13(SSN:
[0-9]{3}-[0-9]{2}-[0-9]{4}^13)", MatchWildcards:=True,
ReplaceWith:="\1\2^p^p", Wrap:=wdFindContinue, Forward:=True,
Replace:=wdReplaceAll
End With
mydoc.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Execute FindText:="[0-9]{3}-[0-9]{3}-[0-9]{4}^13",
MatchWildcards:=True, ReplaceWith:="^p", Wrap:=wdFindContinue,
Forward:=True, Replace:=wdReplaceAll
End With
mydoc.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Execute FindText:="^p^p", MatchWildcards:=False, ReplaceWith:="##",
Wrap:=wdFindContinue, Forward:=True, Replace:=wdReplaceAll
End With
mydoc.Activate
Set mydoc = ActiveDocument
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Execute FindText:="(OH )([0-9)]{5})^13", MatchWildcards:=True,
ReplaceWith:="\1\2##", Wrap:=wdFindContinue, Forward:=True,
Replace:=wdReplaceAll
End With
mydoc.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Execute FindText:="^p", MatchWildcards:=False, ReplaceWith:="^t",
Wrap:=wdFindContinue, Forward:=True, Replace:=wdReplaceAll
End With
mydoc.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Execute FindText:="##", MatchWildcards:=False, ReplaceWith:="^p",
Wrap:=wdFindContinue, Forward:=True, Replace:=wdReplaceAll
End With
mydoc.Activate
mydoc.Range.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=5

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
Teresa Renee Fuller
2100 F Dornbin Drive
Reynoldsburg, OH 43068
SSN: xxx-xx-1432
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411
Anthony D Phillips
1202 Cattail Road
Chillicothe, OH 45601
SSN: xxx-xx-3026
Karen Phillips
1202 Cattail Road
Chillicothe, OH 45601
SSN: xxx-xx-1612
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411
Michelle Santucci Scott
1308 Hideaway Woods
Westerville, OH 43081
SSN: xxx-xx-0904
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411
Theodore M Ahrens
7858 Rock Hollow Ln
Malta, OH 43758
Eleanor D Ahrens
7858 Rock Hollow Ln
Malta, OH 43758
Asst US Trustee
Office of the US Trustee
170 North High Street
Suite 200
Columbus, OH 43215
614-469-7411

Scanner Macro

Keyboard strokes: Ctrl S

Recorded within this Macro:

Edit; Find; More; Special, Paragraph Mark (^p); Replace;
Replace with, Special, Nonbreaking Space (^s); Replace
All; OK.

Find what: manually typed in: SSN: ***-**-***^s (note:
after typing in SSN: ***-**-**** selected Special in order
to add Nonbreaking Space (^s).); Replace with: Special,
Paragraph Mark (^p); click ý Use Wildcards; Replace All;
OK.

Unclick ¨ Use Wildcards; Find what: Special, Any Digit
(^#^#^#-^#^#^#-^#^#^#^#), Special, Nonbreaking Space (^s);
Replace with: Special, Paragraph Mark (^p); Replace All;
OK.

Find what: Special, Nonbreaking Space (^s), Special,
Paragraph Mark (^p); Replace with: Special, Paragraph Mark
(^p); Replace All; OK.

Find what: Special, Nonbreaking Space (^s), manually typed
in: (, Special, Paragraph Mark (^p); Replace with:
Special, Paragraph Mark (^p); Replace All, OK.

Find what: manually pressed space bar one time, Special,
Paragraph Mark (^p); Replace with: Special, Paragraph
Mark (^p); Replace All; OK.

Find what: Special, Nonbreaking Space (^s); Replace
with: Special, Tab Character (^t); Replace All; OK.

Find what: manually pressed space bar one time, Special,
Tab Character (^t); Replace with: Special, Tab Character
(^t); Replace All; OK; Replace All; OK; Replace All; OK.

ý Exited out of Find and Replace Menu.

File; Page Set-up; switched to Landscape.

End Macro: Scanner

At this point, make sure that under Tools, Options, View,
Formatting Marks, ý All, is selected. This way you can
view where in the document you may need to make manual
changes (i.e. The above macro will automatically format
the names and addresses to appear exactly the same as from
the scanned page (example: 558 Madison Avenue, Apt 1 will
appear on two lines as there is a tab "à" mark between Apt
and 1. You will need to delete the tab "à" mark in order
for the full address to appear on one line. Do you want
the name to appear as First and Last separately, then need
to insert a tab "à" mark between first and last name.)
Just keep in mind a new column will be created in the next
macro (ScanContinue) every place you see a tab "à" mark.

ScanContinue Macro

Keyboard strokes: Ctrl C



This Macro will place Names and Address in a Table Form.

Recorded within this Macro:

Ctrl-Home

Edit; Select All

Table; Insert; Table; Ctrl-Home

Table; Insert; Rows Above; Ctrl-Home

Manually Typed in: Name; press table key
Manually Typed in: Address 1; press table key
Manually Typed in: Address 2; press table key
Manually Typed in: Address 3; press table key

End Macro: ScanContinue

Need to Save document in order to do Mail Merge. It is
very important at this time to save file as a Word
Document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top