Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2024, 07:54 AM
vivka vivka is offline Selected Text when in a Table - Accessing Sentence Windows 7 64bit Selected Text when in a Table - Accessing Sentence Office 2016
Expert
 
Join Date: Jul 2023
Posts: 305
vivka is on a distinguished road
Default

hss001, do you want the code to msgbox, select or highlite the found sentence(s)? If the found senetence is selected the original selection will be always broken. Sorry, but I don't quite understand your aim.
Reply With Quote
  #2  
Old 01-04-2024, 08:08 AM
hss001 hss001 is offline Selected Text when in a Table - Accessing Sentence Windows 10 Selected Text when in a Table - Accessing Sentence Office 2021
Novice
Selected Text when in a Table - Accessing Sentence
 
Join Date: Dec 2023
Posts: 20
hss001 is on a distinguished road
Default

Ideally, I want to "select" the "sentence" of the selected text - this will work without needing to modify any other code.

So the below line works fine, EXCEPT when the text is in a table and also the last row - as it picks up end of row characters.

Code:
sStringVariable = oWordApp.Selection.Sentences(1)
@gmayor's code - it doesn't appear to work correctly, in that it doesn't detect if the cell is in the last row.

So, all I need to do is detect if the selection is in the last row of a table, and then strip off the last 2 chars.




Quote:
Originally Posted by vivka View Post
hss001, do you want the code to msgbox, select or highlite the found sentence(s)? If the found senetence is selected the original selection will be always broken. Sorry, but I don't quite understand your aim.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selected Text when in a Table - Accessing Sentence accessing avery label table in macro littlepeaks Word VBA 10 08-09-2022 12:12 PM
Selected Text when in a Table - Accessing Sentence Footnote formatting>"Apply changes to selected text" not limiting changes to selected text Swarup Word 11 07-26-2022 01:51 PM
Selected Text when in a Table - Accessing Sentence 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
Selected Text when in a Table - Accessing Sentence Select Text in Table but Table Gets Selected Too RBusiness Word 1 06-07-2011 04:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:50 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft