Word Cannot Complete the save due to a file permission error RRS feed

  • Question

  • Hello,

    I have the above mentioned issue "Word Cannot Complete the save due to a file permission error" occurring when i change the target framework from 3.5 to 4.0. 

    I'm using C#, Word 2010 & Win 7 32-bit. I didnt get this error when i revert back the target framework to 3.5 but when having the target framework to 4.0 i have this issue also i use embed interop type properties in references to true.

    This is the code flow:

    I open the document(xml) from the C drive and set it for print view mode and saveas to docx type with format (WdFormatDocumentDefault)

    For me it seems the issue with WdFormatDocumentDefault is the issue but it is the same code from 3.5 framework which worked. Any insight on this will help me...

    Thanks in Advance


    Karthick Kannaiyan

    Tuesday, February 25, 2014 5:38 PM

All replies

  • Hi,

    Actually, I fail to reproduce your issue in my side (Windows 7 + Office 2010 + .NET 4.0).

    >> Word cannot complete the save to due to a file permissions error.

    This error may be caused by the anti-virus software, from this kb article, we learned Word need to create, edit, move, and delete the temporary files when we are editing Word documents, well then, problem occurs when any of the action is blocked by the anti-virus software. Try to save your docx file in Windows in Safe Mode, or change the File Block Settings option.

    If it can’t still resolve your issue ,could you provide a simplified example for us to reproduce the issue? a compressed file would be fine.

    so as to we can have a clear idea of figuring out the issue.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, February 28, 2014 3:20 AM
  • Hello Marvin,

    It happens only when the references property is set to True (Embed Interop Types). The references are, Interop.outlook, office.core,VBE.interop and i set the embed interop types to true and causes the issue whereas when i use that property as false it works as usual. 

    I'll try digging in Antivirs software(symantec endpoint protection) to see if there are any conflicts.



    Karthick Kannaiyan

    Friday, February 28, 2014 3:51 PM
  • Hello,

    I couldn't find any relation to the Antivirus Software. 



    Karthick Kannaiyan

    Monday, March 3, 2014 11:30 PM
  • Hi Karthick

    Things don't always run the same when embedding the interop types vs. running directly against the PIAs.

    If you specifically want *.docx type, then try specifying exactly that. The Default setting on any individual computer could be something else, the old *.doc, for instance. So if you want *.docx specifically using the Default is not a good idea, in any case:


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, March 4, 2014 3:25 PM
  • Hello,

    This happens only when i select the 'Embed Interop Types' to True. Even if i declare wdFormatXMLDocument or Default.

    I'm using those properties as i dont want to have users tied to PIAs. Would there be any other route to achieve it ?



    Karthick Kannaiyan

    Tuesday, March 4, 2014 9:28 PM
  • Hi KK

    You might try using PInvoke (GetType().InvokeMember) directly for this one command and avoid the interop types.

    But before you do, also try using the SaveAs2 method as that may be interpreted differently/correctly.

    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 6, 2014 6:57 AM
  • When i use the PInvoke(GetType().InvoikeMember), i'm getting more changes to the code flow. Finally that resulting in design change.  So, i'm going to stop using Embed Interop Type property for now. 

    Also, There are other points.

    1. WordApp.Visible = false when performing those activities.

    2. i use a VSTO customization while using word which have save/saveas disabled in the UI.

    Would that cause any effects on this issue ?

    Karthick Kannaiyan

    Thursday, March 13, 2014 7:48 PM