View Single Post
 
Old 01-10-2024, 02:25 AM
hss001 hss001 is offline Windows 10 Office 2021
Novice
 
Join Date: Dec 2023
Posts: 20
hss001 is on a distinguished road
Default

Hi, I managed to get this working. I found that extending the selection allowed capturing of the sentence, but was stopping my find working.

I used the below code to save the selection, expand the selection and copy the sentence, then reinstate the selection.

Code:
            Dim selCurrent As Object
            Set selCurrent = m_oWordApp.Selection.Range
        
            m_oWordApp.Selection.Expand Unit:=3 ' sentence
            
            sSentenceToSearch = m_oWordApp.Selection
        
            selCurrent.Select
Reply With Quote