473,320 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to Kill the WinWord SpellChecker process I started?

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

Nov 10 '08 #1
2 2781
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
Nov 10 '08 #2
On Nov 10, 2:20*am, "Dean Slindee" <slin...@charter.netwrote:
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
Dean,
As my opinion, killing Word directly using Kill method may cause
unexpected behaviours in next executions of Word such as warnings of
recovered documents etc, so use "Quit" method instead.

Onur Güzel
Nov 10 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bob Swerdlow | last post by:
My application starts up a number of processes for various purposes using: self.popen = popen2.Popen3("/usr/local/bin/python -O "myscript.py") and then shuts them down when appropriate with...
0
by: Just D. | last post by:
Guys, I'm writing the Windows Application and one of the ideas is to use a RichText field to store/show some formatted text, probably with pictures. The problem is that this RichEdit control is...
0
by: Darren Mart via DotNetMonster.com | last post by:
The question: are any user groups besides Administrators permitted to kill processes? Need more info? Happy to oblige: - I'm writing a business object that will run as a service under a...
2
by: Robin Tucker | last post by:
Hi, I am diligently releasing (Marshal.ReleaseComObject (o) ) all references I pick up while generating a report using VB.NET in my software. At least, I *think* I am. However, when I have...
3
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these...
2
by: Dean Slindee | last post by:
The code below is being used to launch WinWord.exe from a VB.NET program. Word launches, but displays this error message: "Word has experienced an error trying to open the file. Try these...
6
by: technocrat | last post by:
i have a process thats in roll back state..i ts going on forever..i need to kill it and would like to restart it with some changes.... if not atleast i need to know the status of the rollback to...
1
by: AE_Cory | last post by:
I'm a n00b to Visual C++ and OOP, but not to programming in general. Here's the problem: Not knowing what I'm doing, I've made my VC++ application as a CLR Window Forms project. Now, I have a...
1
by: ddeterman | last post by:
I am extremely new to C#, so please respond using small words. :-) I am working on a client/server application which creates a word document and attaches it to an e-mail. Once the e-mail is sent, I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.