Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2014, 07:05 AM
gmaxey gmaxey is offline Search in Range Only Problem Windows 7 32bit Search in Range Only Problem Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

NP,



No the problem is universal. Again it is a result of trying to find something in a range when the range is that something. Here is another demo:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
  ActiveDocument.Range.Delete
  ActiveDocument.Range.Text = "Test"
  Set oRng = ActiveDocument.Words(1)
  Debug.Print oRng
  With oRng.Find
    .Text = "Test"
    If .Execute Then
      MsgBox "Found"
    Else
      MsgBox "Not found.  Why? Because the thing we are looking for exactly matches the search range." & _
             " We can't find ""Test"" IN the search range because ""Test"" IS the search range."
    End If
  End With
  'Now redefine the range.
  Set oRng = ActiveDocument.Range '(includes Words(1) and the end of document mark.
  Debug.Print oRng
  With oRng.Find
    .Text = "Test"
    If .Execute Then
      MsgBox "Found."
    End If
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Onenote 2013 search is not identifying search terms correctly Delta223 OneNote 0 08-12-2014 06:40 AM
Search for date and then apply mutliple search criteria in huge dataset maxtymo Excel 2 12-01-2013 04:52 AM
Looking for Windows Search app with ability to search by content gopher_everett Office 1 02-28-2013 09:23 PM
Search Function Problem MageWind Excel 2 06-29-2011 09:46 AM
Search in Range Only Problem Windows explorer search problem...help!! NewSysAdmin Windows 1 03-08-2011 05:33 PM

Other Forums: Access Forums

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