Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-02-2015, 03:10 PM
macropod's Avatar
macropod macropod is offline ActiveDocument.Words(i).Characters.Last.Text statment not working Windows 7 64bit ActiveDocument.Words(i).Characters.Last.Text statment not working Office 2010 32bit
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

The problem you're having is mainly due to each 'word' including the trailing space, if any. Even so, there's a simpler way:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim StrOut As String
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<[!^13 ]@[aeiouy] [aeiouy][! ]@>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    StrOut = StrOut & vbCr & .Text
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
ActiveDocument.Range.InsertAfter vbCr & Chr(12) & "Hiatus List" & StrOut
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveDocument.ContentControls(ID) not working Tejas.T Word VBA 3 03-09-2015 06:50 PM
ActiveDocument.Words(i).Characters.Last.Text statment not working How show characters instead words (status bar) BrunoChirelli Word 2 02-19-2015 12:03 PM
wordapp.ActiveDocument.SaveAs Not Working KSReynolds Mail Merge 1 07-18-2014 04:03 PM
ActiveDocument.Words(i).Characters.Last.Text statment not working Color words ending with special characters Singh_Edm Word 2 01-20-2014 12:51 AM
ActiveDocument.Words(i).Characters.Last.Text statment not working Array into ComboBox + Macro-Text into ActiveDocument Vivi Word VBA 1 01-27-2010 07:03 AM

Other Forums: Access Forums

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