Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 06-09-2014, 04:31 PM
macropod's Avatar
macropod macropod is offline Find what box in Find and replace limits the length of a search term Windows 7 32bit Find what box in Find and replace limits the length of a search term Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,379
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

I don't really see any indication of anything from the two macros I've given you being combined.

Try:
Code:
Sub BarDemo()
Application.ScreenUpdating = False
Dim i As Long, j As Long, bFnd As Boolean
Dim SrcDoc As Document, RsltDoc As Document
Set SrcDoc = ActiveDocument
Set RsltDoc = Documents.Add
With SrcDoc.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<[A-Z][! ]@> <[! ]@> <[! ]@> <[! ]@> <[! ]@> <[! ]@>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute
  End With
  Do While .Find.Found
    bFnd = True
    For i = 1 To UBound(Split(.Text, " "))
      If Not Left(Split(.Text, " ")(i), 1) Like "[A-Z]" Then
        bFnd = False
        .End = .Duplicate.Words(i).End
        Exit For
      End If
    Next
    If bFnd = True Then
      j = j + 1      
      RsltDoc.Range.InsertAfter vbCr
      RsltDoc.Characters.Last.FormattedText = .Duplicate.FormattedText
    End If
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
MsgBox j & " instances found."
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/Find and Replace Loop Tango Mike Word 3 04-20-2014 02:47 PM
Find what box in Find and replace limits the length of a search term Search and replace tabulators of different length...? Flabbergaster Word VBA 9 10-30-2012 05:40 AM
Find what box in Find and replace limits the length of a search term Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
Find what box in Find and replace limits the length of a search term Is there a way to use "find/replace" to find italics words? slayda Word 3 09-14-2011 02:16 PM
Find what box in Find and replace limits the length of a search term can Find/Replace NOT find something? Bobosmite Word 6 05-27-2010 08:09 PM

Other Forums: Access Forums

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