Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 03-28-2022, 02:52 PM
macropod's Avatar
macropod macropod is offline How do I find the last character in a line? Windows 10 How do I find the last character in a line? Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There is a way of doing this, but its progress won't exactly be stellar on long documents:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim wdPage As Page, wdRct As Rectangle, wdRng As Range, wdLine As Line
For Each wdPage In ActiveDocument.ActiveWindow.Panes(1).Pages
  For Each wdRct In wdPage.Rectangles
    For Each wdLine In wdRct.Lines
      Set wdRng = wdLine.Range
      With wdRng
        If .Characters.Last.Text Like "[–—]" Then
          .MoveEndUntil Cset:=" ", Count:=wdBackward
          .InsertAfter Chr(11)
        End If
      End With
    Next
  Next
Next
Application.ScreenUpdating = True
End Sub
Do be aware of the caveats in my previous post.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
find character, line

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header line only in text box using a different character set anne4651 Publisher 0 07-03-2018 03:45 PM
How do I find the last character in a line? Find first character of a line Deferolles Word 11 04-26-2018 12:18 AM
How do I find the last character in a line? Delete Character on Single Line Only Tye30 Word VBA 8 04-20-2017 08:40 PM
How do I find the last character in a line? Every page indents first line one character glennhardy Word 6 02-05-2016 04:05 PM
How do I find the last character in a line? Use character instead of line for table border dlowrey Word Tables 6 03-09-2015 11:29 AM

Other Forums: Access Forums

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