![]() |
|
#14
|
|||
|
|||
|
So my codes below - highlighting where I want to retrieve the sentence. If I modify the selection the code doesn't function correctly.
Code:
m_oWordDoc.Bookmarks("\StartOfDoc").Select
m_oWordApp.Selection.Find.ClearFormatting
With m_oWordApp.Selection.Find
.Text = sPhraseToFind
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = bMatchCase
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While m_oWordApp.Selection.Find.Execute = True
sSentenceToSearch = m_oWordApp.Selection.Sentences(1)
*** Above is incorrect if the found text is the last row in a table ***
' Additional Code
End If
Loop
End With
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
accessing avery label table in macro
|
littlepeaks | Word VBA | 10 | 08-09-2022 12:12 PM |
Footnote formatting>"Apply changes to selected text" not limiting changes to selected text
|
Swarup | Word | 11 | 07-26-2022 01:51 PM |
Find and Replace Selected Text or Macro for finding selected text
|
mrplastic | Word VBA | 4 | 12-20-2019 01:25 PM |
| Word for Mac 2011: Problems accessing Text Boxes programmatically | techy291 | Word VBA | 0 | 07-16-2017 08:41 AM |
Select Text in Table but Table Gets Selected Too
|
RBusiness | Word | 1 | 06-07-2011 04:26 PM |