Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 07-08-2019, 08:43 PM
gmayor's Avatar
gmayor gmayor is offline search in specific page Windows 10 search in specific page Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If the aim of the game is to delete xxx and yyy from each page but the first then

Code:
Sub DelTexts()
Dim vFind As Variant
Dim oRng As Word.Range
Dim i As Integer
    vFind = Array("xxx", "yyy")
    For i = 0 To UBound(vFind)
        Set oRng = ActiveDocument.Range
        With oRng.Find
            Do While .Execute(FindText:=vFind(i), MatchWildcards:=True)
                If oRng.Information(wdActiveEndPageNumber) > 1 Then
                    oRng.Text = ""
                End If
                oRng.Collapse 0
            Loop
        End With
    Next i
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
page count, search and replace



Similar Threads
Thread Thread Starter Forum Replies Last Post
search in specific page Search for lines that DO NOT have specific character knpaddac Word 1 01-14-2019 01:16 PM
search in specific page Macro to search for specific words in a document mike0215 Word VBA 2 11-28-2017 07:25 AM
Search for specific data in a text string teligence Excel 1 05-20-2017 11:51 AM
search in specific page Search for multiple texts in cell, return specific text mariur89 Excel 4 12-14-2014 01:33 AM
search in specific page Search first section for specific string... donaldadams1951 Word VBA 4 03-14-2014 11:24 AM

Other Forums: Access Forums

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