Hellow.
My project is to send letter to ms word 2010 using c# 2010.
the reference :
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools
for Office\PIA\Office12\Microsoft.Office.Interop.Word.dll
when i compile the program i got a warning about ambiguity between ms.Quit and (may be) from system.Quit
unfortunatley this warning does not appears any more
my goal is to close and then quit the ms word using
Object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
Object originalFormat = Type.Missing;
Object routeDocument = Type.Missing;
wrdApp.Documents.Close(ref saveChanges,ref originalFormat, ref routeDocument);
wrdApp.Quit(ref saveChanges,ref originalFormat, ref routeDocument);
in the code above(see my comment in line B) ,i got a green zigzag line under the word (i do not mean ms word) Quit (see line B)
but when i made line B a comment and uncomented line A
i got this message
Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass'
to interface type 'Microsoft.Office.Interop.Word._Document'.
this operation failed because the QueryInterface call on the COM
component for the interface with IID '{0002096B-0000-0000-C000-000000000046}'
failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002
those are some lines in my code which might help
using Word = Microsoft.Office.Interop.Word;
using System.Diagnostics;
namespace Wared
{
public partial class WordOrderForm : Form
{
Word.Application wrdApp;
Word._Document wrdDoc;
what is the save code which can close and quit ms word from c# project ?