Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2012, 11:36 AM
KevinJ KevinJ is offline VBA equivalent to selecting present word Windows 7 64bit VBA equivalent to selecting present word Office 2010 32bit
Novice
VBA equivalent to selecting present word
 
Join Date: Oct 2011
Posts: 4
KevinJ is on a distinguished road
Default VBA equivalent to selecting present word


I'm just looking for a way in VBA to select the present word when the selection point is anywhere within the Word. I.e., to do the same thing as when you double-click on a Word and it selects the same.

Thank you!
Reply With Quote
  #2  
Old 11-05-2012, 01:03 PM
Lawmuse Lawmuse is offline VBA equivalent to selecting present word Windows 7 32bit VBA equivalent to selecting present word Office 2010 32bit
Novice
 
Join Date: Nov 2012
Posts: 4
Lawmuse is on a distinguished road
Default

It looks like the .Extend and .Expand methods of the Selection object might do what you want. This is from the help for extend:

Code:
With Selection   
  ' Collapse current selection to insertion point.   
  .Collapse   
  ' Turn extend mode on.   
  .Extend   
  ' Extend selection to word.   
  .Extend   
  ' Extend selection to sentence.   
  .Extend  
End With
Or try this:
Code:
Selection.Expand ' default unit is wdWord
Reply With Quote
  #3  
Old 11-05-2012, 01:27 PM
KevinJ KevinJ is offline VBA equivalent to selecting present word Windows 7 64bit VBA equivalent to selecting present word Office 2010 32bit
Novice
VBA equivalent to selecting present word
 
Join Date: Oct 2011
Posts: 4
KevinJ is on a distinguished road
Default

Perfect! I'll try the Selection.Expand.

Thanks!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
folders present but not listed under email confuseis Outlook 0 05-21-2012 02:06 PM
VBA equivalent to selecting present word Autocorrect in Word not selecting proper entry from list Llewella Word 4 05-12-2012 02:22 PM
VBA equivalent to selecting present word If I reinstall Outlook, will I retain my present files natureandpictures Outlook 2 05-11-2011 08:28 AM
VBA equivalent to selecting present word Selecting merge field based on whether or not text is present amym Mail Merge 1 12-07-2010 05:14 AM
ClipMate equivalent in Word? P. Alkuin Word 0 03-11-2010 03:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:46 AM.


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