469,592 Members | 2,032 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Word application quit

private Interop.Word.Application _wordApp;

What is the differences betwenn

_wordApp.Quit(...)

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


Mar 1 '07 #1
2 11163
On Mar 1, 6:38 pm, "Alan T" <alanpltseNOS...@yahoo.com.auwrote:
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/lib...it(VS.80).aspx
http://msdn2.microsoft.com/de-de/lib...it(VS.80).aspx

Mar 2 '07 #2
"Alan T" <al*************@yahoo.com.auwrote in message
news:OS*************@TK2MSFTNGP06.phx.gbl...
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.
Mar 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Stefania Scott | last post: by
reply views Thread by jorgedec | last post: by
reply views Thread by Alan T | last post: by
reply views Thread by Alan T | last post: by
14 posts views Thread by Alan T | last post: by
reply views Thread by Armen Kirakosyan | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.