D
**Developer**
Below is my first script code.
I did it sometime ago and I believe I copied most of it from somewhere.
I would appreciate any suggested improvements.
The main reason for this post is that when I shutdown XP I'm notified
sometimes that Word is running.
I wonder it this code might be the culprit.
Thanks in advance
Option Explicit
Dim objWord, Word, WshShell, BtnCode, strSuggestion, lstSuggestions
Do While True
word = InputBox ("What word would you like to check?","Type the word to
check","")
if word = "" then WScript.Quit
Set objWord = CreateObject("Word.Application")
objWord.visible=False
objWord.Documents.Add.Content = word
if objWord.CheckSpelling(word) then
lstSuggestions = "Word is spelled OK."
else
lstSuggestions = ""
for each strSuggestion in objWord.GetSpellingSuggestions(word)
lstSuggestions = lstSuggestions & vbCrLf & strSuggestion
next
end if
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup(lstSuggestions, , "Spelling Suggestions
for """ & word & """. Click OK to Enter Another Word", 1 + 32)
Select Case BtnCode
case 2 WScript.Quit
case -1 WScript.Echo "Is there anybody out there?"
End Select
Loop
I did it sometime ago and I believe I copied most of it from somewhere.
I would appreciate any suggested improvements.
The main reason for this post is that when I shutdown XP I'm notified
sometimes that Word is running.
I wonder it this code might be the culprit.
Thanks in advance
Option Explicit
Dim objWord, Word, WshShell, BtnCode, strSuggestion, lstSuggestions
Do While True
word = InputBox ("What word would you like to check?","Type the word to
check","")
if word = "" then WScript.Quit
Set objWord = CreateObject("Word.Application")
objWord.visible=False
objWord.Documents.Add.Content = word
if objWord.CheckSpelling(word) then
lstSuggestions = "Word is spelled OK."
else
lstSuggestions = ""
for each strSuggestion in objWord.GetSpellingSuggestions(word)
lstSuggestions = lstSuggestions & vbCrLf & strSuggestion
next
end if
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup(lstSuggestions, , "Spelling Suggestions
for """ & word & """. Click OK to Enter Another Word", 1 + 32)
Select Case BtnCode
case 2 WScript.Quit
case -1 WScript.Echo "Is there anybody out there?"
End Select
Loop