943,834 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 8981
  • C# RSS
May 14th, 2009
0

Microsoft.Office.Interop.Word problem

Expand Post »
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

C# Syntax (Toggle Plain Text)
  1.  
  2. Microsoft.Office.Interop.Word.ApplicationClass wordApp = new ApplicationClass();
  3.  
  4. object file = textBox1.Text;
  5. object nullobj = System.Reflection.Missing.Value;
  6.  
  7. 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);
  8.  
  9. doc.ActiveWindow.Selection.WholeStory();
  10. doc.ActiveWindow.Selection.Copy();
  11. IDataObject data = Clipboard.GetDataObject();
  12.  
  13. richTextBox1.Text = data.GetData(DataFormats.Text).ToString();
  14.  
  15. doc.Close(ref file, ref nullobj,ref nullobj);
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
gallian99 is offline Offline
77 posts
since Jan 2009
May 15th, 2009
0

Re: Microsoft.Office.Interop.Word problem

I didn't try your code but have a look on http://msdn.microsoft.com/en-us/libr...a2(VS.80).aspx and if it raises an error reply again.
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006
Nov 16th, 2011
0

Hi

object readOnly=false;
wordApp .Documents.Close(ref readOnly, ref readOnly, ref missing);
doc= null;
wordApp .Quit(ref missing, ref missing, ref missing);
Reputation Points: 10
Solved Threads: 0
Newbie Poster
vineeta.agarwal is offline Offline
1 posts
since Nov 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: SIP message manipulation
Next Thread in C# Forum Timeline: How can I get DataColumn's Field Size.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC