473,700 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Quitting "Word.Applicati on" Help Please

Hi

Im doing something wrong in quitting the Word.Applicatio n in my VB program.
I have

General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me

When I click Exit to end my program Winword.exe is still running as a
process listed in my Task Manager. Not only is it listed, but the process is
taking up 100% of my CPU usage.
How do I end the Word.Applicatio n correctly ???

Thanks
Trevor.
Jul 17 '05 #1
5 13570
The first thing I see is that you are using a mix of Early and Late binding
to create your object.

This is your code as it stands:
General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me
In early binding mode it should be: General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = New Word.Applicatio n

In Late Binding mode (using createobject()) it should be: General Declarations
Dim AppWord As Object

Form_Load()
Set AppWord = CreateObject("W ord.Application ")
Try the same code to end your word application object as you have with one
of these two declarations (early or late binding). and see if it still
causes a problem.

--
Stéphane Richard

"The Roys" <tr*****@hotmai l.com> wrote in message
news:VK******** ************@ne ws-server.bigpond. net.au... Hi

Im doing something wrong in quitting the Word.Applicatio n in my VB program. I have

General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me

When I click Exit to end my program Winword.exe is still running as a
process listed in my Task Manager. Not only is it listed, but the process is taking up 100% of my CPU usage.
How do I end the Word.Applicatio n correctly ???

Thanks
Trevor.

Jul 17 '05 #2
Thanks for your reply, but either way makes no difference. Before exiting,
and while program is dormant the process in the Task Manager (Winword.exe)
does not take up any CPU usage. But as soon as I run the Exit code the CPU
usage goes to 100% and the process is still in the Task Manager.
Every time I run the program a new Winword.exe process begins.

Any ideas ??
"Stephane Richard" <st************ **@verizon.net> wrote in message
news:QE******** **********@nwrd ny03.gnilink.ne t...
The first thing I see is that you are using a mix of Early and Late binding to create your object.

This is your code as it stands:
General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me
In early binding mode it should be:
General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = New Word.Applicatio n


In Late Binding mode (using createobject()) it should be:
General Declarations
Dim AppWord As Object

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

Try the same code to end your word application object as you have with one
of these two declarations (early or late binding). and see if it still
causes a problem.

--
Stéphane Richard

"The Roys" <tr*****@hotmai l.com> wrote in message
news:VK******** ************@ne ws-server.bigpond. net.au...
Hi

Im doing something wrong in quitting the Word.Applicatio n in my VB

program.
I have

General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me

When I click Exit to end my program Winword.exe is still running as a
process listed in my Task Manager. Not only is it listed, but the

process is
taking up 100% of my CPU usage.
How do I end the Word.Applicatio n correctly ???

Thanks
Trevor.


Jul 17 '05 #3
Just my guess:

Is there some code create a varable (probably at form level) that references
object in Word.Applicatio n somewhere between Foam_Load and cmdExit_Click,
which is still alive (not set to Nothing)?

If you simply try to start Word.Applicatio n and close it in the same
procedure, like below, I'll bet Word.Applicatio n would quit cleanly:

Private Sub cmdTest_Click()

Dim AppWord As Word.Applicatio n

Set AppWord=New Word.Applicatio n 'You can use CreateObject() if you
wish

MsgBox "Word launched"

AppWord.Quit;
'.............. ......
End Sub

If Word.Applicatio n quits correctly here, then find some code in your
project that has something to do with AppWord before cmdExit_Click

"The Roys" <tr*****@hotmai l.com> wrote in message
news:oV******** ************@ne ws-server.bigpond. net.au...
Thanks for your reply, but either way makes no difference. Before exiting,
and while program is dormant the process in the Task Manager (Winword.exe)
does not take up any CPU usage. But as soon as I run the Exit code the CPU
usage goes to 100% and the process is still in the Task Manager.
Every time I run the program a new Winword.exe process begins.

Any ideas ??
"Stephane Richard" <st************ **@verizon.net> wrote in message
news:QE******** **********@nwrd ny03.gnilink.ne t...
The first thing I see is that you are using a mix of Early and Late

binding
to create your object.

This is your code as it stands:
General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me


In early binding mode it should be:
General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = New Word.Applicatio n


In Late Binding mode (using createobject()) it should be:
General Declarations
Dim AppWord As Object

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

Try the same code to end your word application object as you have with one of these two declarations (early or late binding). and see if it still
causes a problem.

--
Stéphane Richard

"The Roys" <tr*****@hotmai l.com> wrote in message
news:VK******** ************@ne ws-server.bigpond. net.au...
Hi

Im doing something wrong in quitting the Word.Applicatio n in my VB

program.
I have

General Declarations
Dim AppWord As Word.Applicatio n

Form_Load()
Set AppWord = CreateObject("W ord.Application ")

cmdExit_Click()
AppWord.Quit
Set AppWord = Nothing
Unload Me

When I click Exit to end my program Winword.exe is still running as a
process listed in my Task Manager. Not only is it listed, but the

process
is
taking up 100% of my CPU usage.
How do I end the Word.Applicatio n correctly ???

Thanks
Trevor.



Jul 17 '05 #4
Yes Norman, You are absolutely correct. I am using the the spell checker in
word. If the spell checker is not used then the Winword.exe process does
close correctly.
Ok, now how do I close it down correctly if I do use the spell checker. The
spell checker code I have is:
If (AppWord.CheckS pelling(searchW ord) Then
'This is a word -
count = count + 1
End If
This is the only code in my program which accesses Winword.
Do I also need to close the CheckSpelling process ???

"Norman Yuan" <no********@Rem oveThis.shaw.ca > wrote in message
news:oMCjb.1094 82$pl3.80542@pd 7tw3no...
Just my guess:

Is there some code create a varable (probably at form level) that references object in Word.Applicatio n somewhere between Foam_Load and cmdExit_Click,
which is still alive (not set to Nothing)?

If you simply try to start Word.Applicatio n and close it in the same
procedure, like below, I'll bet Word.Applicatio n would quit cleanly:

Private Sub cmdTest_Click()

Dim AppWord As Word.Applicatio n

Set AppWord=New Word.Applicatio n 'You can use CreateObject() if you
wish

MsgBox "Word launched"

AppWord.Quit;
'.............. ......
End Sub

If Word.Applicatio n quits correctly here, then find some code in your
project that has something to do with AppWord before cmdExit_Click

"The Roys" <tr*****@hotmai l.com> wrote in message
news:oV******** ************@ne ws-server.bigpond. net.au...
Thanks for your reply, but either way makes no difference. Before exiting,
and while program is dormant the process in the Task Manager (Winword.exe) does not take up any CPU usage. But as soon as I run the Exit code the CPU usage goes to 100% and the process is still in the Task Manager.
Every time I run the program a new Winword.exe process begins.

Any ideas ??
"Stephane Richard" <st************ **@verizon.net> wrote in message
news:QE******** **********@nwrd ny03.gnilink.ne t...
The first thing I see is that you are using a mix of Early and Late

binding
to create your object.

This is your code as it stands:
> General Declarations
> Dim AppWord As Word.Applicatio n
>
> Form_Load()
> Set AppWord = CreateObject("W ord.Application ")
>
> cmdExit_Click()
> AppWord.Quit
> Set AppWord = Nothing
> Unload Me

In early binding mode it should be:
> General Declarations
> Dim AppWord As Word.Applicatio n
>
> Form_Load()
> Set AppWord = New Word.Applicatio n
>

In Late Binding mode (using createobject()) it should be:
> General Declarations
> Dim AppWord As Object
>
> Form_Load()
> Set AppWord = CreateObject("W ord.Application ")
>
Try the same code to end your word application object as you have with

one of these two declarations (early or late binding). and see if it still causes a problem.

--
Stéphane Richard

"The Roys" <tr*****@hotmai l.com> wrote in message
news:VK******** ************@ne ws-server.bigpond. net.au...
> Hi
>
> Im doing something wrong in quitting the Word.Applicatio n in my VB
program.
> I have
>
> General Declarations
> Dim AppWord As Word.Applicatio n
>
> Form_Load()
> Set AppWord = CreateObject("W ord.Application ")
>
> cmdExit_Click()
> AppWord.Quit
> Set AppWord = Nothing
> Unload Me
>
> When I click Exit to end my program Winword.exe is still running as a > process listed in my Task Manager. Not only is it listed, but the

process
is
> taking up 100% of my CPU usage.
> How do I end the Word.Applicatio n correctly ???
>
> Thanks
> Trevor.
>
>



Jul 17 '05 #5
I have just solved my problem.
I have accessed the Spell Checker via Excel rather than Winword, and the
process closes correctly.
Is this a bug with Winword, or a bug in my Winword, don't know, don't really
need to know now.

Thanks for your help guys.

"The Roys" <tr*****@hotmai l.com> wrote in message
news:At******** ************@ne ws-server.bigpond. net.au...
Yes Norman, You are absolutely correct. I am using the the spell checker in word. If the spell checker is not used then the Winword.exe process does
close correctly.
Ok, now how do I close it down correctly if I do use the spell checker. The spell checker code I have is:
If (AppWord.CheckS pelling(searchW ord) Then
'This is a word -
count = count + 1
End If
This is the only code in my program which accesses Winword.
Do I also need to close the CheckSpelling process ???

"Norman Yuan" <no********@Rem oveThis.shaw.ca > wrote in message
news:oMCjb.1094 82$pl3.80542@pd 7tw3no...
Just my guess:

Is there some code create a varable (probably at form level) that references
object in Word.Applicatio n somewhere between Foam_Load and cmdExit_Click,
which is still alive (not set to Nothing)?

If you simply try to start Word.Applicatio n and close it in the same
procedure, like below, I'll bet Word.Applicatio n would quit cleanly:

Private Sub cmdTest_Click()

Dim AppWord As Word.Applicatio n

Set AppWord=New Word.Applicatio n 'You can use CreateObject() if you wish

MsgBox "Word launched"

AppWord.Quit;
'.............. ......
End Sub

If Word.Applicatio n quits correctly here, then find some code in your
project that has something to do with AppWord before cmdExit_Click

"The Roys" <tr*****@hotmai l.com> wrote in message
news:oV******** ************@ne ws-server.bigpond. net.au...
Thanks for your reply, but either way makes no difference. Before exiting, and while program is dormant the process in the Task Manager (Winword.exe) does not take up any CPU usage. But as soon as I run the Exit code the CPU usage goes to 100% and the process is still in the Task Manager.
Every time I run the program a new Winword.exe process begins.

Any ideas ??
"Stephane Richard" <st************ **@verizon.net> wrote in message
news:QE******** **********@nwrd ny03.gnilink.ne t...
> The first thing I see is that you are using a mix of Early and Late
binding
> to create your object.
>
> This is your code as it stands:
> > General Declarations
> > Dim AppWord As Word.Applicatio n
> >
> > Form_Load()
> > Set AppWord = CreateObject("W ord.Application ")
> >
> > cmdExit_Click()
> > AppWord.Quit
> > Set AppWord = Nothing
> > Unload Me
>
> In early binding mode it should be:
> > General Declarations
> > Dim AppWord As Word.Applicatio n
> >
> > Form_Load()
> > Set AppWord = New Word.Applicatio n
> >
>
> In Late Binding mode (using createobject()) it should be:
> > General Declarations
> > Dim AppWord As Object
> >
> > Form_Load()
> > Set AppWord = CreateObject("W ord.Application ")
> >
> Try the same code to end your word application object as you have
with one
> of these two declarations (early or late binding). and see if it

still > causes a problem.
>
> --
> Stéphane Richard
>
>
>
> "The Roys" <tr*****@hotmai l.com> wrote in message
> news:VK******** ************@ne ws-server.bigpond. net.au...
> > Hi
> >
> > Im doing something wrong in quitting the Word.Applicatio n in my VB
> program.
> > I have
> >
> > General Declarations
> > Dim AppWord As Word.Applicatio n
> >
> > Form_Load()
> > Set AppWord = CreateObject("W ord.Application ")
> >
> > cmdExit_Click()
> > AppWord.Quit
> > Set AppWord = Nothing
> > Unload Me
> >
> > When I click Exit to end my program Winword.exe is still running
as a > > process listed in my Task Manager. Not only is it listed, but the
process
> is
> > taking up 100% of my CPU usage.
> > How do I end the Word.Applicatio n correctly ???
> >
> > Thanks
> > Trevor.
> >
> >
>
>



Jul 17 '05 #6

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

Similar topics

4
16179
by: Microsoft | last post by:
I'm trying to display a word document inside a web page, but everytime I do I get this error: Error Type: Microsoft VBScript runtime (0x800A0046) Permission denied: 'CreateObject' Does anybody know the correct way to do this? I don't want to link to a document, but rather display a word file inside the asp page.
3
5341
by: Greg Andora | last post by:
Hello, I've had an ASP page that worked for at the minimum for a year and now it is acting very odd and I need some help to fix it. What my page does/did is creates a Word.Application object and a new document from a template. It then proceeds to fill in a bunch of the information on the word document using bookmarks and data from a database. Then it saves the document to a directory and sends the user off to go get the new document. ...
3
6014
by: gdogg1587 | last post by:
Greetings. I'm working on a program that will "descramble" words. Think of a word scramble game where there is a list of characters, and several blank spaces to denote the word(s) that you are to come up with from the list. i.e.(* denotes a space): _ _ _ _ _ * _ _ _ _ _ _ characters: .hwodlelrlo answer: hello world.
2
10241
by: MaxiWheat | last post by:
Hi, I am using a software that uses MS Word to create PDF files. When I try to run the sample code (ASP 3.0), I get an error on this statement : Set oWord = Server.CreateObject("Word.Application") That error says : The call to Server.CreateObject failed while checking permissions. Access is denied to this object.
4
8009
by: Darryl Kerkeslager | last post by:
Below is a section of the code I use to open Word with late binding, insert text at the selected bookmarks, and make Word visible. Everything works fine. However, I also have some Word check boxes, that I cannot figure out how to make 'checked'. I am not allowed to alter the layout of the form; it must be a check box. Up until now, I have simply required users to check the box themselves, but now I'm opening up four Word forms that all...
5
9369
by: KC | last post by:
Hi, I have code similar to this.. Dim xlApp As Object xlApp = CreateObject("Excel.Application", "\\MyServer") The call is from a asp.net (Intranet) application. \\Myserver is a network computer in the same domain as web server. The only way I can get this call worked is when I add the user who logs on to the web site as Administrators. I need to get this working without having to make the user administrator. Any suggestion?
2
3187
by: Claus - Arcolutions | last post by:
I got a word document as a stream, and I want to get the text from the word document. But I cant seem to find anything to use for that purpose. The "Microsoft office ?.object" com reference, only include functionality to read from a file (as far as I know). I looked a little on the structure of the document, but it doesnt seem to have any common structures, especially not if you compare from different office versions.
5
1432
by: Filip De Backer | last post by:
hi everyone, I want a textbox with word layout. And than save this text to a field in a sql server. how can I do that? thanks for the answers Filip
1
1477
by: Shar Shar | last post by:
Hi All, Actually I want to use "Word.ApplicationClass" class for opening a word file. And do following things, 1) Open word file. 2) Insert text in bookmark field. 3) Print resultant file as pdf. Has anyone solution how can I do this programmatically in C#.
0
8709
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
9202
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...
1
8952
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7791
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6555
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
4649
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3081
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
2371
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2018
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.