Microsoft.Office.Interop.Word problem

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 68
Reputation: gallian99 is an unknown quantity at this point 
Solved Threads: 0
gallian99 gallian99 is offline Offline
Junior Poster in Training

Microsoft.Office.Interop.Word problem

 
0
  #1
May 14th, 2009
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

  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);
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Microsoft.Office.Interop.Word problem

 
0
  #2
May 15th, 2009
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.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC