473,404 Members | 2,195 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,404 software developers and data experts.

Quiting Word.Application

I'm trying to use Office's FileSearch object to search for files.
I'm using Visual Studio 2002 c# and Word 2000.

The problem I am having is realeasing the Word.Application object.
When I try to use the Quit() method I get an error:

"Microsoft Word for Windows has encountered a problem and needs to
close. We are sorry for the inconvenience"

Either way I end up with multiple WinWord processes running.

Here is part of my code:

Office.FileSearch fs;
Word.Application w;
w = new Word.Application();
fs = w.FileSearch;

fs.NewSearch();

{do search - this part works}

System.Runtime.InteropServices.Marshal.ReleaseComO bject(fs);
fs = null;
object saveChanges = false;
object missing = System.Reflection.Missing.Value;
w.Quit(ref saveChanges,ref missing,ref missing);
System.Runtime.InteropServices.Marshal.ReleaseComO bject(w);
w = null;

If I comment out all parts having to do with FileSearch (ie just create
Word.Application and then use Quit() )
it works and WinWord is terminated.

I think I need to get rid of the FileSearch object first, before using
Quit() but I am not sure how to do this.

jorge de cardenas

Aug 18 '06 #1
0 1297

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

Similar topics

5
by: The Roys | last post by:
Hi Im doing something wrong in quitting the Word.Application in my VB program. I have General Declarations Dim AppWord As Word.Application Form_Load() Set AppWord =...
8
by: sudha | last post by:
Hi, To open a word doc from c#, i use the following code : Word.ApplicationClass WordApp = new Word.ApplicationClass (); // give any file name of your choice. object fileName =...
0
by: Bill | last post by:
Hi all, I have developed a component to wrap MS-Word, and I use this to manage my reports. It´s a simple components, but it´s very useful...to eliminate this very tiresome declarations like...
7
by: Zeke | last post by:
I'm using the following code to create word document but the problem is if you go to task manager you'll see a WINWORD.EXE process is running but not the application, here is the code: ...
1
by: Bernd Muent | last post by:
Hi together, I am using the following code in Visual Basic to open Word or Excel applications: Word: Dim w As Word.Application w = CType(CreateObject("Word.application"), Word.Application)...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
7
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the...
1
by: Mitch Wardrop | last post by:
ok here it goes I must be doing something way off but it makes sense to me just not to VB.NET which would be a huge problem. Anyways I'll explain what I am doing than give code examples. basicly...
3
by: Barry Edmund Wright | last post by:
Hi All, MS Access 2003 - using a split database. I am using a switchboard. I have set in Options to "Compact on Close". What code do I put behind the Exit button on the switchboard so the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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,...
0
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...

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.