![]() |
|
#7
|
|||
|
|||
|
30ai.dotm text is:
[1] text [2] text [] [3] text d [Monday] text add [1] asdfasd [asadfasdf] The code is Option Explicit Sub RevertEndKey() On Error Resume Next Application.KeyBindings.Clear keyCode:=BuildKeyCode(wdKeyEnd) On Error GoTo 0 End Sub Sub AssignEndKey() On Error Resume Next Application.KeyBindings.Add keyCode:=BuildKeyCode(wdKeyEnd), _ keyCategory:=wdKeyCategoryMacro, Command:="SelNext" On Error GoTo 0 End Sub Sub CreateRevertHotkey() On Error Resume Next Application.KeyBindings.Add keyCode:=BuildKeyCode(wdKeyShift, wdKeyControl, wdKeyF8), _ keyCategory:=wdKeyCategoryMacro, Command:="RevertEndKey" On Error GoTo 0 End Sub Sub CreateAssignHotkey() On Error Resume Next Application.KeyBindings.Add keyCode:=BuildKeyCode(wdKeyShift, wdKeyControl, wdKeyF9), _ keyCategory:=wdKeyCategoryMacro, Command:="AssignEndKey" On Error GoTo 0 End Sub Sub SelNext() On Error GoTo ErrHandler Dim findText As String findText = "\[*\]" With Selection.Find .Text = findText .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With If Selection.Find.Found Then ' Do nothing, found and selected text Else ' Do nothing, no text found End If Exit Sub ErrHandler: ' Handle error silently End Sub cannot get the assigned key to revert, my coding is limited and chatgpt is useless any suggestions appreciated |
| Tags |
| disable macro, enable macro, toggle macro assignment |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Autosave toggle missing completely in Word
|
MikeyLasco77 | Word | 6 | 03-02-2023 07:08 AM |
| Word Refuses to Allow Macros, even when All Macros Enabled | devlon | Word VBA | 3 | 10-04-2022 02:15 PM |
MERGESEQ does not appear to be having a value assigned
|
gjone43 | Mail Merge | 6 | 10-15-2020 08:15 PM |
| vba editor - how to toggle the continuous display of all macros in a module | floattube | Word VBA | 0 | 11-28-2014 01:35 PM |
| Is there a way to toggle the contents that are displayed in a Word document? | sclind | Word | 1 | 02-24-2012 04:56 PM |