Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2023, 03:45 PM
vivka vivka is offline Getting the last of three names/words Windows 7 64bit Getting the last of three names/words Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, RobiNew, your macro with my minor modifications is good :
Code:
Sub LastName()
Set orng = ActiveDocument.range
orng.Collapse
orng.MoveStartUntil Cset:=Chr(13)
orng.Collapse wdCollapseEnd
orng.Previous(Unit:=wdWord, count:=2).Select
MsgBox selection
End Sub
The code works without problems if the first paragraph's last lettered word is followed only by a period, any number (incl. zero) of spaces and VbCr.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Foreign words/names Read Aloud HanselM Word 1 05-01-2023 09:36 AM
Getting the last of three names/words Removing microsoft build-in style names - display of style names in styles gallery changed Firebody Word 8 03-06-2022 08:22 AM
How to find (highlight) two and more words in a list of 75k single words in Word 2010 Usora Word 8 05-29-2018 03:34 AM
Need to extract domain names containing only specific words (MAJOR BULK) Maxwell314 Excel 4 12-08-2014 05:10 PM
How to enter names in Resource Pool/names pstein Project 1 03-26-2012 07:37 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:11 AM.


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