Word application quit

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

private Interop.Word.Application _wordApp;

What is the differences betwenn

_wordApp.Quit(...)

and _wordApp.Application.Quit(...) ?
 
private Interop.Word.Application _wordApp;

What is the differences betwenn

_wordApp.Quit(...)

and _wordApp.Application.Quit(...) ?

I'm not sure if I have the exact two Quit methods you reference (I
think there are a few more in Word Interop), but I believe

_wordApp.Application.Quit(...)

is the one you want to use while

_wordApp.Quit(...)

is not meant to be called from code. It is possible that I have these
switched, so check the links at the end of this post to make sure I
got it right.

http://msdn2.microsoft.com/de-de/library/microsoft.office.interop.word._application.quit(VS.80).aspx
http://msdn2.microsoft.com/de-de/li...nterop.word.applicationclass.quit(VS.80).aspx
 
Alan T said:
private Interop.Word.Application _wordApp;

What is the differences betwenn

_wordApp.Quit(...)

and _wordApp.Application.Quit(...) ?

Don't know where you get _wordApp.Application from, IMO this is not possible, here :
private Interop.Word.Application _wordApp;
you declare a variable _wordApp to be of type Interop.Word.Application.
and here:
_wordApp.Application.Quit(...)
you call Quit on what actually should look like
Interop.Word.Application.Application.Quit(..)
but there is no such class (or interface) Interop.Word.Application.Application

As I told you in another thread, Application refers to an interface, and ApplicationClass
refers to the class implementing Application. You should set the variable to
ApplicationClass like this:

private Interop.Word.ApplicationClass _wordApp;
....
_wordApp = new Interop.Word.ApplicationClass();
....
_wordApp.Quit(...);

Note that I also don't get where you got this "Interop.Word" from, the importer should
generate "Microsoft.Office.Interop.Word" as namespace. Wonder where you got the interop
assembly from.
Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top