Find and Replace

(include a page under for Automating)


Find

You can quickly find statements or properties using the Find dialog box.
Edit > Find
Find button on the Standard toolbar
Shortcut Key (Ctrl+F)

Find What -
Current Procedure - only the current programming procedure in the Code window
Current Module - only the macros in the current module (the default)
Current Project - all the macros in all modules within the current project
Selected Text - only the text that you've selected in the Code window (disabled if no selection has been made)
Direction - This drop-down contains the commands: All, Down, Up
Find Whole Word Only -
Match Case -
Use Pattern Matching -
Find Next - The first occurrence of the word will be found and highlighted. If you close the dialog box you can continue to find more occurrences by pressing F3.
Replace - Displays the Replace dialog box (see below)
Help -


Replace

Lets you find and replace in a single operation
Edit > Replace
Shortcut Key (Ctrl + H)

This is exactly the same as the Find just with some additional controls
Replace With -
Replace - replaces the highlighted text with the text in the text box
Replace All -


SS - The specified region has been searched (pressing F3)


Searching For Text In A Module

The CodeModule object has a Find method that you can use to search for text within the code module.
The Find method accepts parameters that specify the range of lines and column to search.
To find the next occurrence of the text, you need to set the parameters to refer to the text following the found line and column.
The Find method returns True or False indicating whether the text was found.
This code will search all of the code in Module1 and print a Debug message for each found occurrence.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext