Find&Replace Tab 
Author Message
 Find&Replace Tab

I have created a function to transfer information from
access to word. Once the transfer is complete I am using
the following code to delete unneccessary paragraph breaks:
With WordObj

.ActiveDocument.Range(0, 0).Select

   .Selection.Find.ClearFormatting
   .Selection.Find.Replacement.ClearFormatting
   .Selection.Find.Text = "^p^p"
   .Selection.Find.Replacement.Text = "^p"
   .Selection.Find.Forward = True
   .Selection.Find.Wrap = wdFindContinue
   .Selection.Find.Format = False
   .Selection.Find.MatchCase = False
   .Selection.Find.MatchWholeWord = False
   .Selection.Find.MatchWildcards = False
   .Selection.Find.MatchSoundsLike = False
   .Selection.Find.MatchAllWordForms = False
   Do While .Selection.Find.Execute
       .Selection.Find.Execute Replace:=wdReplaceAll
   Loop
End With

This works a treat, however, I have a number of lines
which have a tab and a space before the paragraph break.
Does anyone know how I tell word to find this?

Any help gratefully received.

Kind Regards
Phill



Sun, 29 Feb 2004 03:03:24 GMT  
 Find&Replace Tab
Hi, Phill,

The code for a tab is ^t, and the space is just a space. So the .Find.Text
would be "^t ^p".

--
Regards,
Jay Freedman
Microsoft Word MVP        Word MVP FAQ site: http://www.mvps.org/word


Quote:
> I have created a function to transfer information from
> access to word. Once the transfer is complete I am using
> the following code to delete unneccessary paragraph breaks:
> With WordObj

> .ActiveDocument.Range(0, 0).Select

>    .Selection.Find.ClearFormatting
>    .Selection.Find.Replacement.ClearFormatting
>    .Selection.Find.Text = "^p^p"
>    .Selection.Find.Replacement.Text = "^p"
>    .Selection.Find.Forward = True
>    .Selection.Find.Wrap = wdFindContinue
>    .Selection.Find.Format = False
>    .Selection.Find.MatchCase = False
>    .Selection.Find.MatchWholeWord = False
>    .Selection.Find.MatchWildcards = False
>    .Selection.Find.MatchSoundsLike = False
>    .Selection.Find.MatchAllWordForms = False
>    Do While .Selection.Find.Execute
>        .Selection.Find.Execute Replace:=wdReplaceAll
>    Loop
> End With

> This works a treat, however, I have a number of lines
> which have a tab and a space before the paragraph break.
> Does anyone know how I tell word to find this?

> Any help gratefully received.

> Kind Regards
> Phill



Sun, 29 Feb 2004 04:56:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Find & Replace Problem - ACC97

2. Find& replace one by one

3. Find & Replace using input box

4. FIND & REPLACE

5. Multiple find & replace

6. Find&replace-code

7. find & Replace with wild cards and patterns

8. Need VBA to Search for Tabs, Replace with Default Tabs

9. find/replace on headers&footers

10. Excel macro to find&replace in MSWord

11. Global Find & Replace

12. Find & replace question

 

 
Powered by phpBB® Forum Software