473,666 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Kill the WinWord SpellChecker process I started?

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

Nov 10 '08 #1
2 2795
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
Nov 10 '08 #2
On Nov 10, 2:20*am, "Dean Slindee" <slin...@charte r.netwrote:
Using this statement to utilize the spell checker in WinWord:
* * * * *WinOffice.clsW ord.SpellChecke r(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
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
7042
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 os.kill(self.popen.pid, signal.SIGTERM) Everything works fine on MacOSX. However, I'm doing a port to Solaris (so I can run it on my web site) and find that the child processes are not stopping! Solaris is creating TWO new processes: one for the SHELL...
0
1406
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 very poor and I'd like to use WinWord for significant editing. I also don't want to exclude the RichEdit control for some light changes of the same text. So the problem is to start WinWord so that the main application should be frozen until...
0
1531
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 specific username (won't run as System). - the object creates an instance of Word and automates a Mail Merge. (Yes, I know this is not recommended -- that's another thread for another day...)
2
4209
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 finished using the WINWORD.EXE com server, I still have a reference to it hanging somewhere in my code (I know this because it remains in task manager). I have checked and double checked but can't find it (although of course I am sure it must be...
3
11728
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 suggestions. 1) Check the file permissions for the document or drive. 2) Make sure there is sufficient free memory and disk space. 3) Open the file with the Text Recovery converter." The document that I want to display is on my PC and was created by...
2
4507
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 suggestions. 1) Check the file permissions for the document or drive. 2) Make sure there is sufficient free memory and disk space. 3) Open the file with the Text Recovery converter." The document that I want to display is on my PC and was created by...
6
6010
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 estimate how longer it migt take...no use with this..but just for my info.... killing roll back process would be ideall...if not recommended what are the risks that might come up due to rollback...becuase i badly need to kill this and start...
1
1718
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 process that is lauched by pushing a button. The code for this process is inside the Button_Click event handler for that particular button. The problem is that I need to be able to kill that process with another button. I have a global flag...
1
3550
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 need to kill the WINWORD process on the server. Unfortunately, everyone who uses this application is running under the same credentials, so I can not identify the correct process based on the user name. The session number does not seem to be...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6189
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.