Microsoft Word Prank (5 / 7 steg)
Steg 5: Kod apa!
1) här koden gör det så när någonsin den person som använder ordet typer E stänger dokumentet utan att spara. Koden är
Sub AddKeyBinding()
CustomizationContext = formatmallen Normal
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyE), KeyCategory: = wdKeyCategoryCommand, _
Kommandot: = "TestKeybinding"
End Sub
Sub TestKeybinding()
Dim x som dokument
Ange x = ActiveDocument
x.Close (falskt)
End Sub
2) detta tilltag gör ofta felstavade ord visas korrekt så ingen röd linje visas under den.
Sub AutoExec()
Kalla WriteToATextFile
Dim dicCustom som ordbok
Ange dicCustom = Application.CustomDictionaries _
. Add(filename:="c:\customdic5.dic")
Application.CustomDictionaries.ActiveCustomDictionary = dicCustom
Med ansökan
CustomizationContext = formatmallen Normal
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeySpacebar), KeyCategory: = wdKeyCategoryCommand, _
Kommandot: = "spellit"
Avsluta med
End Sub
Sub WriteToATextFile()
MinFil = "c:\customdic5.dic"
fnum = FreeFile()
Öppna MinFil för produktionen som fnum
Skriva ut #fnum, "den"
Skriva ut #fnum, "Matte"
Nära #fnum
End Sub
Public Sub spellit()
Selection.TypeText Text: = ""
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Med Selection.Find
. Text = "den"
. Replacement.Text = "den"
. Framåt = sant
. Wrap = wdFindContinue
. Format = False
. MatchCase = sant
. MatchWholeWord = False
. MatchWildcards = False
. MatchSoundsLike = False
. MatchAllWordForms = False
Avsluta med
Selection.Find.Execute Ersätt: = wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Med Selection.Find
. Text = "Den"
. Replacement.Text = "Matte"
. Framåt = sant
. Wrap = wdFindContinue
. Format = False
. MatchCase = sant
. MatchWholeWord = False
. MatchWildcards = False
. MatchSoundsLike = False
. MatchAllWordForms = False
Avsluta med
Selection.Find.Execute Ersätt: = wdReplaceAll
End Sub
3) detta tilltag gör svär slumpmässigt visas medan person skriver.
Sub typeRand()
Dim counter As String
räknare = CStr (Int ((30-1 + 1) * Rnd + 1))
Application.OnTime när: = nu + TIDVÄRDE ("00:00:" + counter), _
Namn: = "TimedClose"
End Sub
Sub TimedClose()
Dim maindocument som dokument
Ange maindocument = activedocument
räknare = CStr (Int ((5-1 + 1) * Rnd + 1))
Välj mål counter
Fall 1
Selection.TypeText Text: = ""
Fall 2
Selection.TypeText Text: = ""
Fall 3
Selection.TypeText Text: = ""
Fall 4
Selection.TypeText Text: = ""
Fall 5
Selection.TypeText Text: = ""
End Select
Kalla typeRand
End Sub