Unable to save word document

Add-in Express™ Support Service
That's what is more important than anything else

Unable to save word document
 
Omri Suissa


Guest


Hi,
When i'm trying to save the current word document:

object refObject = new object();
WordApp.ActiveDocument.SaveAs(ref "c:	est.docx", Word.WdSaveFormat.wdFormatDocumentDefault, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject, ref refObject); 


but i keep getting:
"Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"

What i'm doing wrong?

Thanks,
Omri
Posted 29 Nov, 2011 08:08:15 Top
Eugene Astafiev


Guest


Hi Omri,

First of all, please note that you don't release underlying COM objects properly in the code. You can read more about this in the http://www.add-in-express.com/creating-addins-blog/2008/10/30/releasing-office-objects-net/ article. Also please take a look at the http://www.add-in-express.com/creating-addins-blog/2006/08/17/outlook-not-closing/ article on our technical blog.

Did you try to specify Type.Missing or just omit optional parameters instead of using the refObject in the code?
Posted 29 Nov, 2011 08:54:04 Top
Omri Suissa


Guest


Thanks,
Type.Missing was my problem.
about the com release, this is just an example, but thanks :)

Omri
Posted 29 Nov, 2011 10:35:02 Top