Last active
October 27, 2019 09:59
-
-
Save supergrass71/de183e7f0c8025ac11b310d3798af824 to your computer and use it in GitHub Desktop.
Replace In Table #Word
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ReplaceInTable(textToFind As String) As String | |
'http://www.msofficeforums.com/word-vba/28049-vba-table-search-all-tables-find-replace.html | |
Dim oRng As Range | |
Set oRng = ActiveDocument.Range | |
'if used as sub add inputbox for texttofind | |
With oRng.Find | |
Do While .Execute(FindText:=textToFind) | |
If oRng.Information(wdWithInTable) Then | |
oRng.Select | |
Selection.Cells(1).Next.Select | |
Set oRng = Selection.Range | |
ReplaceInTable = CleanTrim(oRng.Text, True) | |
GoTo lbl_Exit | |
End If | |
Loop | |
End With | |
lbl_Exit: | |
'ReplaceInTable = "" 'could not find a reference table | |
Exit Function | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment