Figured it out. Here is the SpellChecker code. Just commented the last two
lines, as shown here:
Public Shared Sub SpellChecker(By Ref strText As String)
Dim app As Word.Applicatio n = New Word.Applicatio n()
Dim doc As Word.Document = app.Documents.A dd()
If (strText.Length 0) Then
app.Visible = False
app.WindowState = 0
Dim template As Object = Missing.Value
Dim newTemplate As Object = Missing.Value
Dim documentType As Object = Missing.Value
Dim booVisible As Object = False
Dim optionalParm As Object = Missing.Value
doc = app.Documents.A dd(template, newTemplate, documentType,
booVisible)
doc.Words.First .InsertBefore(s trText)
Dim wpe As Word.Proofreadi ngErrors = doc.SpellingErr ors
doc.CheckSpelli ng(optionalParm , optionalParm, optionalParm,
optionalParm, optionalParm, optionalParm, optionalParm, optionalParm,
optionalParm, optionalParm, optionalParm, optionalParm)
strText = doc.Range(0, doc.Characters. Count - 1).Text
Dim saveChanges As Object = False
Dim originalFormat As Object = Missing.Value
Dim routeDocument As Object = Missing.Value
app.Quit(saveCh anges, originalFormat, routeDocument)
'app = New Word.Applicatio n()
'doc = app.Documents.A dd()
End If
End Sub
"Dean Slindee" <sl*****@charte r.netwrote in message
news:72******** *************** ***********@mic rosoft.com...
Using this statement to utilize the spell checker in WinWord:
WinOffice.clsWo rd.SpellChecker (txtNote.Text)
'this does not work because no main window is displayed
'Dim proc = Process.GetProc essesByName("wi nword")
'For i As Integer = 0 To proc.Count - 1
' proc(i).CloseMa inWindow()
'Next i
'this closes all WinWord processes silently (a little overkill):
Dim procs() As Process = Process.GetProc essesByName("wi nword")
For i As Integer = 0 To procs.Count - 1
procs(i).Kill()
Next i
Is there a way to kill only the WinWord process I started by calling
SpellChecker?
Thanks,
Dean S