Figured it out. Here is the SpellChecker code. Just commented the last two
lines, as shown here:
Public Shared Sub SpellChecker(ByRef strText As String)
Dim app As Word.Application = New Word.Application()
Dim doc As Word.Document = app.Documents.Add()
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.Add(template, newTemplate, documentType,
booVisible)
doc.Words.First.InsertBefore(strText)
Dim wpe As Word.ProofreadingErrors = doc.SpellingErrors
doc.CheckSpelling(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(saveChanges, originalFormat, routeDocument)
'app = New Word.Application()
'doc = app.Documents.Add()
End If
End Sub
"Dean Slindee" <sl*****@charter.netwrote in message
news:72**********************************@microsof t.com...
Using this statement to utilize the spell checker in WinWord:
WinOffice.clsWord.SpellChecker(txtNote.Text)
'this does not work because no main window is displayed
'Dim proc = Process.GetProcessesByName("winword")
'For i As Integer = 0 To proc.Count - 1
' proc(i).CloseMainWindow()
'Next i
'this closes all WinWord processes silently (a little overkill):
Dim procs() As Process = Process.GetProcessesByName("winword")
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