Thread: [Solved] Find Replace
View Single Post
 
Old 03-01-2013, 04:03 AM
Adriano Adriano is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Feb 2013
Posts: 10
Adriano is on a distinguished road
Default

Paul,

Thanks a lot!

I've managed to solve the puzzle with your help.

The code is:


Code:
Sub remove_tables()

Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "([a-z]\))"
    .Style = "table-1"
    .Replacement.Text = ""
    .Format = bSty
    .Forward = True
    .Wrap = wdFindStop
    .MatchCase = True
    .MatchWholeWord = True
    .MatchWildcards = True
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    If .Information(wdWithInTable) = True Then
      .Duplicate.Tables(1).ConvertToText Separator:=vbTab
    End If
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Exit Sub
errExit:
Beep
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 02-08-2021 at 10:44 PM. Reason: Added code tags
Reply With Quote