![]() |
#4
|
|||
|
|||
![]()
Hello Paul
Thanks for the macro, it worked great.!! ![]() After running the macro I realized that there was more data that need to be extracted. And they are in a block format. The format of the block is below beginning code=abc bunch of data 908+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data Sample Data =========== beginning code=abc bunch of data 908+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 908+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data beginning code=abc bunch of data 510+555-1212 ending code=xyz garbage data garbage data garbage data garbage data garbage data I was able to locate the 9 digit phone number with the following code. Code:
Do Selection.Find.ClearFormatting With Selection.Find .Text = "^?^?^?+^?^?^?-^?^?^?^?" .Replacement.Text = """" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveRight Unit:=wdCharacter, Count:=2 Selection.HomeKey Unit:=wdLine, Extend:=wdExtend Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend Selection.Cut Windows(2).Activate Selection.Paste Selection.TypeParagraph Windows(1).Activate Loop Until Selection.Find.Found = False 1) find the 9 digits number and take out that whole record into a new window 2) now the next few records are just in sequence following the 1st record, so the macro should check to see if the next records have the same number, if it finds it then it should delete THAT NUMBER and then check for the next record and so on, once it finds a unique number then it should extract THAT RECORD AND ADD IT DOWN BELOW 1ST RECORD THAT WAS EXTRACTED IN THAT NEW WINDOW. any help would be greatly appreciated. Thanks a lot. Last edited by macropod; 06-15-2012 at 06:22 PM. Reason: Added code tags & formatting |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
designer | PowerPoint | 1 | 10-14-2011 08:00 AM |
![]() |
Mark Micallef | Outlook | 1 | 08-04-2010 02:38 PM |
Can I Extract a Page from Word and Make a New DOCX File? | tatihulot | Word | 1 | 06-20-2010 11:38 PM |
in WORD, how do i type a 9-digit phone number "xxxxxxxxx" and have it automatically.. | jay8962 | Word | 0 | 04-08-2010 11:08 AM |
automatically extract footnotes into new file and apply character format to footnote | hrdwa | Word | 0 | 02-27-2010 03:16 AM |