473,598 Members | 3,138 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 13559
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
16158
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
5336
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
6011
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
10232
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
7998
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
9351
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
3176
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
1428
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
1464
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
8393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8048
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
8263
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...
0
6713
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
5848
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
3896
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1503
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1246
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.