Wednesday, December 12th, 2007...9:43 pm

Computer Prank - Spelling Bee


If you are new to the site, sign up for the RSS Feed. All new sign ups get punch and pieRSS feed. Thanks for visiting!


If you read my blog there is one thing you know for sure, I’m not going to win any spelling contest any time soon. I get comments all the time from the grammar/spelling police, ” Learn how to use spell check, dumb@$!@ “. I wrote this macro for those people. What this macro does is when ever you load word, it creates a custom dictionary. This custom dictionary contains common words, but misspelled. Whenever you type its correct equivalent it then misspells the word. This normally would have an big red squally line below but the custom dictionary takes care of that. The misspelled word now looks nice and perfect, because Word thinks its perfect. So how do you do it?

Step one
Open up Microsoft Word

Step two
Press alt f-11 ( This opens the code view )

Step three
Open your normal template. It is under Normal… Microsoft Word Objects… ThisDocument… Double click on this document

Step four
Copy the Code Below

Sub AutoExec()
Call WriteToATextFile
Dim dicCustom As Dictionary
Set dicCustom = Application.CustomDictionaries _
.Add(FileName:=“c:\customdic5.dic”)
Application.CustomDictionaries.ActiveCustomDictionary = dicCustom

With Application
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeySpacebar), KeyCategory:=wdKeyCategoryCommand, _
Command:=“spellit”
End With

End Sub

Sub WriteToATextFile()
MyFile = “c:\customdic5.dic”
fnum = FreeFile()
Open MyFile For Output As fnum
Print #fnum, “teh”
Print #fnum, “Teh”
Close #fnum
End Sub

Public Sub spellit()
Selection.TypeText Text:=“ ”
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = “the”
.Replacement.Text =“teh”
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = “The”
.Replacement.Text =“Teh”
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

End Sub

Step5: Press Save

Step6: Close Word

Step7: Enjoy

If you have done this correctly you will now have a custom dictionary with misspellings galore. Every time they load word it will load this dictionary and the misspellings to get with it. Even if they were to delete the dictionary it self the code will recreate it every time.

Extras

To add more words then “TEH” there are few things you will have to do.

  • Copy the line Print #fnum, “teh”
  • Paste Print #fnum, “teh” right below where you copied it on to the next line
  • The new line you just pasted Print #fnum, “teh” Change the word “teh” to what ever word you would like
  • Next add the key change
  • Copy the code
    • Selection.Find.ClearFormatting
      Selection.Find.Replacement.ClearFormatting
      With Selection.Find
      .Text = “the”
      .Replacement.Text = “teh”
      .Forward = True
      .Wrap = wdFindContinue
      .Format = False
      .MatchCase = True
      .MatchWholeWord = False
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
      End With
      Selection.Find.Execute Replace:=wdReplaceAll
  • Paste the code below the code you just copied on the line below
  • Change .Text=”the” and .Replacement.Text=”teh” with the original word and the word you want it to change to.

All done. You could make this more efficient but for simplicity sake we will just copy and paste.

How do you undo it?

Replace the code you put in originaly with this and click the run button

FindKey(BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyA)).Clear
application.CustomDictionaries.ClearAll
, , , , , , , , , , ,

StumbleUpon It!

2 Comments

Leave a Reply