Link to home
Start Free TrialLog in
Avatar of TechnologyDoctor
TechnologyDoctorFlag for United States of America

asked on

F6 Find and Highlight Macro

Upgraded a computer from Windows 7/MSOffice 2013 to Windows 10/Office 365, and yes I checked with the vendor for compatibility issues.  However, unknown to me, there was a MSWord macro in use that would find a * placeholder in the real estate closing documents so that they could be easily moved to and highlighted by pressing F6.  This would allow the user to move to the correct spot, input the correct data and delete the placeholder *, with a single key stroke.  I have a copy of the macro, but it will not work in Office 365, it just launches the new Find and Replace function in Office 365.  Does anyone have an idea?  Old macro below.

Sub F6()
'
' F6 Macro
'
'
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "*"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
End Sub
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Word Online or Word downloaded to desktop?

If Word is anything like Excel, the online version does not allow macros.
Make sure that the code in question is in a regular module

Add this macro to the Thisdocument module in the VBA window, save the document, CLOSE it and then reopen it.

Private Sub Document_Open()
    With Application
        .CustomizationContext = ThisDocument
        .KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF6), _
        KeyCategory:=wdKeyCategoryCommand, _
        Command:="F6"
    End With
End Sub
Avatar of TechnologyDoctor

ASKER

Word downloaded to the desktop.  Thank you for your time and consideration.
Syed, Would the solution have to be added each time a document was created by the closing software or one time to the normal.dot template?
Try adding it to the Thisdocument module of the "Normal" file.
Syed, I am either not understanding your instructions or they are not working for me.  I created a macro with a Thisdocument name and copied and pasted your text and saved into the normal file.  When I attempt to get the F6 function to run, all I get are highlighed symbols at the top of my screen, not even in the word document.
F6-Error.jpg
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.