|
|
|
|
|
|
Excel
|
Notify That the Spell Checker Was Used
|
|
Ease of Use
|
Intermediate
|
Version tested with
|
2002
|
Submitted by:
|
Jacob Hilderbrand
|
Description:
|
This macro can cancel the Spell Checker use, or run any code when the Spell Checker is used.
|
Discussion:
|
You want to run some code whenever the Spell Checker is used. This macro allows you to do just that.
|
Code:
|
instructions for use
|
Option Explicit
Sub SpellCheckerChange()
Dim CmdBar As CommandBar
Dim CmdCtl As CommandBarControl
For Each CmdBar In CommandBars
Set CmdCtl = CmdBar.FindControl(ID:=2, recursive:=True)
If Not CmdCtl Is Nothing Then CmdCtl.OnAction = "CustomSpellChecker"
Next CmdBar
Set CmdBar = Nothing
Set CmdCtl = Nothing
End Sub
Sub SpellCheckerReset()
Dim CmdBar As CommandBar
Dim CmdCtl As CommandBarControl
For Each CmdBar In CommandBars
Set CmdCtl = CmdBar.FindControl(ID:=2, recursive:=True)
If Not CmdCtl Is Nothing Then CmdCtl.OnAction = ""
Next CmdBar
Set CmdBar = Nothing
Set CmdCtl = Nothing
End Sub
Sub CustomSpellChecker()
MsgBox "You tried to use the Spell Checker"
Selection.CheckSpelling
End Sub
|
How to use:
|
- Open Excel.
- Alt + F11 to open the VBE.
- Insert | Module.
- Paste the code there.
- Modify the macro CustomSpellChecker to do whatever you want, currently it is setup to display a message box.
- Close the VBE (Alt + Q or press the X in the top right corner).
- If you want set a keyboard shortcut (F7) to the CustomSpellChecker macro to disable the default SpellChecker shortcut.
- To set the keyboard shortcut review the help file for Application.OnKey
|
Test the code:
|
- Tools | Macro | Macros...
- Select SpellCheckereChange and press Run to change the SpelllChecker buttons.
- Select SpellCheckereCopy and press Run to reset the SpellChecker buttons back to normal.
|
Sample File:
|
SpellChecker.zip 5.63KB
|
Approved by mdmackillop
|
This entry has been viewed 127 times.
|
|