Hi,
Can anyone show me how to make the MS Word Spell check window to show on top of all other windows open? I am using the standard spell check code from the MS knowledge base. And whenever spell check is called it hides the window at the end of the list when you Alt+Tab to view all open applications. I do not want my users to have to Alt+Tab everytime they call a spell check. I am using Windows 7, Word 2010 and Visual Studio 2010. Here is the code:
If txtnotes.Text.Length > 0 Then
' Make a Word server object.
Dim word_server As New Word.Application
' Hide the server.
word_server.Visible = False
' Make a Word Document.
Dim doc As Word.Document = _
word_server.Documents.Add()
Dim rng As Word.Range
' Make a Range to represent the Document.
rng = doc.Range()
' Copy the text into the Document.
rng.Text = txtnotes.Text
' Activate the Document and call its CheckSpelling
' method.
doc.Activate()
doc.CheckSpelling()
' Copy the results back into the TextBox,
' trimming off trailing CR and LF characters.
Dim chars() As Char = {CType(vbCr, Char), _
CType(vbLf, Char)}
txtnotes.Text = doc.Range().Text.Trim(chars)
' Close the Document, not saving changes.
doc.Close(SaveChanges:=False)
' Close the Word server.
word_server.Quit()
End If
Thanks!
Razzle
Can anyone show me how to make the MS Word Spell check window to show on top of all other windows open? I am using the standard spell check code from the MS knowledge base. And whenever spell check is called it hides the window at the end of the list when you Alt+Tab to view all open applications. I do not want my users to have to Alt+Tab everytime they call a spell check. I am using Windows 7, Word 2010 and Visual Studio 2010. Here is the code:
If txtnotes.Text.Length > 0 Then
' Make a Word server object.
Dim word_server As New Word.Application
' Hide the server.
word_server.Visible = False
' Make a Word Document.
Dim doc As Word.Document = _
word_server.Documents.Add()
Dim rng As Word.Range
' Make a Range to represent the Document.
rng = doc.Range()
' Copy the text into the Document.
rng.Text = txtnotes.Text
' Activate the Document and call its CheckSpelling
' method.
doc.Activate()
doc.CheckSpelling()
' Copy the results back into the TextBox,
' trimming off trailing CR and LF characters.
Dim chars() As Char = {CType(vbCr, Char), _
CType(vbLf, Char)}
txtnotes.Text = doc.Range().Text.Trim(chars)
' Close the Document, not saving changes.
doc.Close(SaveChanges:=False)
' Close the Word server.
word_server.Quit()
End If
Thanks!
Razzle