Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-17-2025, 11:05 AM
Ddadoo57 Ddadoo57 is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 11 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2021
Advanced Beginner
How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word)
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default How to select 2 distinct parts of the active document (as we do with Ctrl + mouse in Word)

Hello,



Is it possible in Word VBA to select 2 distinct parts of the active document, I mean not one after the other? ( as we do with Ctrl + mouse in Word)

For example, I have the following content in my document and I want to select paragraph 1 and 3 only.

Paragraph 1
Paragraph 2
Paragraph 3
Paragraph 4

Thanks for your help!
Reply With Quote
  #2  
Old 03-17-2025, 12:47 PM
Italophile Italophile is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 11 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

No, non-contiguous selections are not possible in VBA.
Reply With Quote
  #3  
Old 03-17-2025, 12:52 PM
Ddadoo57 Ddadoo57 is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 11 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2021
Advanced Beginner
How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word)
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default

Thanks for your feedback Italophile !
Have a nice day !
Reply With Quote
  #4  
Old 03-18-2025, 10:42 AM
gmaxey gmaxey is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 10 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

While is it is not possible to select it in the sense you ask, it is possible to highlight or manipulate in other ways. What is you end goal?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #5  
Old 03-19-2025, 02:33 AM
Ddadoo57 Ddadoo57 is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 11 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2021
Advanced Beginner
How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word)
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default

Hi, Yes I understand, it's really the non-contiguous selection I wanted, not the highlighting.

I'll work it out another way.

Thanks for your reply.
Reply With Quote
  #6  
Old 03-19-2025, 04:24 AM
Italophile Italophile is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 11 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2021
Expert
 
Join Date: Mar 2022
Posts: 542
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Don't forget that when working in VBA it is neither necessary nor advisable to select anything. Work with the objects directly instead, e.g. Paragraph, Range
Reply With Quote
  #7  
Old 03-19-2025, 10:29 AM
Ddadoo57 Ddadoo57 is offline How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Windows 11 How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Office 2021
Advanced Beginner
How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word)
 
Join Date: Feb 2023
Posts: 90
Ddadoo57 is on a distinguished road
Default

yes, most of the time I use Range and Paragraph, but this was a special case.
Thanks, Italophile!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with an active document and new document to retain styles and cross-referencing ctviggen Word VBA 10 01-28-2024 08:46 AM
Active cell not the one I select with curser. hayesfam3 Excel 0 08-15-2019 05:14 AM
How to save active document to SharePoint document library Rose roon Word VBA 9 09-22-2015 10:53 PM
How  to select 2 distinct parts of the active document  (as we do with Ctrl + mouse in Word) Cannot select single characters. Word selects paragraphs or parts of sentences. TMinnich Word 2 10-25-2013 09:38 AM
Method to active "Select Drawing Objects" rgustin Word VBA 1 08-18-2012 11:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:48 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