0

Hi,

I'm getting the error at the doc.close in the last argument; type mismatch error

using object 11 com addin; for which the doc.close takes 3 arguments.

thx

Microsoft.Office.Interop.Word.ApplicationClass wordApp = new ApplicationClass();

            object file = textBox1.Text;
            object nullobj = System.Reflection.Missing.Value;

            Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);                              

            doc.ActiveWindow.Selection.WholeStory();
            doc.ActiveWindow.Selection.Copy();
            IDataObject data = Clipboard.GetDataObject();

            richTextBox1.Text = data.GetData(DataFormats.Text).ToString();

            doc.Close(ref file, ref nullobj,ref nullobj);
3
Contributors
2
Replies
5
Views
8 Years
Discussion Span
Last Post by vineeta.agarwal
0

object readOnly=false;
wordApp .Documents.Close(ref readOnly, ref readOnly, ref missing);
doc= null;
wordApp .Quit(ref missing, ref missing, ref missing);

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.