Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-29-2014, 12:51 PM
gmaxey gmaxey is offline VBA to Find and Format Text string defined using Inputbox within selection Windows 7 32bit VBA to Find and Format Text string defined using Inputbox within selection 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

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
Dim oRngProcess As Word.Range
  Set oRng = Selection.Range
  Set oRngProcess = oRng.Duplicate
  With oRng.Find
    .Text = InputBox("Enter text to find.")
    Do
      .Execute
      If oRng.InRange(oRngProcess) Then
        With oRng
          .Font.ColorIndex = wdRed
          .Font.StrikeThrough = True
          .Collapse wdCollapseEnd
        End With
      Else
        Exit Do
      End If
    Loop
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to Find and Format Text string defined using Inputbox within selection Find text, format part of text in italic d4okeefe Word VBA 18 06-30-2022 11:35 PM
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
VBA to Find and Format Text string defined using Inputbox within selection Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
VBA to Find and Format Text string defined using Inputbox within selection Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM
VBA to Find and Format Text string defined using Inputbox within selection Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

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