Word opening mysteriously
Word opening mysteriously
Word opening mysteriously
Word opening mysteriously
Word opening mysteriously
Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously
Word opening mysteriously Word opening mysteriously
Word opening mysteriously
Go Back  Xtreme Visual Basic Talk > > > Word opening mysteriously


Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2010, 03:33 PM
pells pells is offline
Newcomer
 
Join Date: Jul 2004
Posts: 17
Default Word opening mysteriously


I have a program that at one point will open word and export some info. That works perfect, however I have just noticed each day I have a number of winwords open (can only see them in task manager so they are hidden). It appears that everytime I start the program it opens a hidden winword session. It has nothing to do with the code I have on the form, it opens before any code I have written is executed.

Any ideas?
Reply With Quote
  #2  
Old 05-28-2010, 06:26 PM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi pells,

What is happening is that your code is not correctly cleaning up your Word Application instance when it shuts down. The result is that Word appears to exit, but part of the application is still left running, as can be seen within the Task Manager (as you have found out).

Using the correct cleanup procedures is a somewhat complicated topic, but it's not that bad once you understand the basic principles. I would have a read of the Automating Office Programs with VB.NET tutorial to get a handle of this. It is written using Excel as an example, but the principles are exactly the same as with Microsoft Word.

After reading the tutorial, give the principles a try. If you are still having trouble, then show your code and we'll try to help you out.

Sound good?

Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
  #3  
Old 06-01-2010, 10:39 AM
pells pells is offline
Newcomer
 
Join Date: Jul 2004
Posts: 17
Default

Thanks Mike.

I looked at the cleanup again, and it appeared fine. Then by accident I found the issue, when I was declaring the object on form load (I needed it as a global), I used "NEW" by accident. Then later on I was calling the object when I needed it. So even my clean up was only catching the second. Once I removed "NEW" problem solved.
Reply With Quote
  #4  
Old 06-01-2010, 11:16 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Yes, sounds like your first instance was never used and never released. Glad you caught it.
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Word opening mysteriously
Word opening mysteriously
Word opening mysteriously Word opening mysteriously
Word opening mysteriously
Word opening mysteriously
Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously Word opening mysteriously
Word opening mysteriously
Word opening mysteriously
 
Word opening mysteriously
Word opening mysteriously
 
-->