Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2020, 05:42 PM
Bscott Bscott is offline Search and goto Windows 10 Search and goto Office 2016
Novice
Search and goto
 
Join Date: Mar 2020
Posts: 1
Bscott is on a distinguished road
Default Search and goto

Hello colleagues, Was wondering If I could get some Help. I would like to create a search Macro for word 2016. What I have is a document I've created a text box and a Search button. Now I'd like to create code so that when I type a search word in the text box and press the search button the Macro then search the word document and go the that location. Any help would be greatly appreciated.





Thank you all very much.
Reply With Quote
  #2  
Old 03-21-2020, 09:26 PM
gmayor's Avatar
gmayor gmayor is offline Search and goto Windows 10 Search and goto Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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 of
Default

You could have recorded that, however call the macro below with the value from your text box.



Code:
Sub FindWord(sWord As String)
    With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = sWord
        .Execute
    End With
End Su
__________________
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
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
GoTo Cell Reference in wdTable Hdata Word VBA 6 02-10-2017 05:34 AM
Search and goto Application.GoTo a Range in another Window sgbooth Excel Programming 1 11-21-2015 12:19 PM
Inserting a contents with a "GOTO" jrmourning Word 1 11-21-2014 07:03 AM
Search for date and then apply mutliple search criteria in huge dataset maxtymo Excel 2 12-01-2013 04:52 AM
Search and goto Word GoTo From Excel mata30s Word VBA 14 12-10-2012 09:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft