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:

  1. Open Excel.
  2. Alt + F11 to open the VBE.
  3. Insert | Module.
  4. Paste the code there.
  5. Modify the macro CustomSpellChecker to do whatever you want, currently it is setup to display a message box.
  6. Close the VBE (Alt + Q or press the X in the top right corner).
  7. If you want set a keyboard shortcut (F7) to the CustomSpellChecker macro to disable the default SpellChecker shortcut.
  8. To set the keyboard shortcut review the help file for Application.OnKey
 

Test the code:

  1. Tools | Macro | Macros...
  2. Select SpellCheckereChange and press Run to change the SpelllChecker buttons.
  3. 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.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express