none
Could not use SaveAs for the read only file - Word 2013 RRS feed

  • Question

  • The below code is not working for the specific word document which is marked as read only.

    oDoc.SaveAs(FileName:=fName, Password:="", WritePassword:=wrPassword)

    Wednesday, October 7, 2015 8:13 AM

Answers

  • Hi SomaSundaram R,

    The code works well for me.

    Please ensure the name of file you want to save was not used by other application. Most probably was opened by Word application, you can try to close all the Word process via task manager.

    Hope it is helpful.

    Regards & Fei


    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.

    • Marked as answer by SomaSundaram R Thursday, October 8, 2015 11:56 AM
    Thursday, October 8, 2015 2:18 AM
    Moderator

All replies

  • Hello Soma,

    Did you try to save the document manually? Do you get the same results?

    What file name do you pass to the SaveAs method?

    Wednesday, October 7, 2015 9:24 AM
  • Thank you for your reply. Yes, I am able to do it manually.

    The actual file name is "Saf1SafetyInspection1.docx" and i tried to save it as "Saf1SafetyInspection1_V15_work_sra8cob.docx"

    Wednesday, October 7, 2015 10:04 AM
  • The code prompts the saveAs window(This should not happen) and if i cancel getting the error as : COMExpection was caught"Command failed"

    if i select some other location and store it from the prompt getting the below error message:

    We can’t save this file because it’s read-only.
    To keep your changes, you'll need to save the document with a new name or in a different location.

    Error Code: -2146823133


    SomaSundaram R


    Wednesday, October 7, 2015 1:35 PM
  • Hi SomaSundaram R,

    The code works well for me.

    Please ensure the name of file you want to save was not used by other application. Most probably was opened by Word application, you can try to close all the Word process via task manager.

    Hope it is helpful.

    Regards & Fei


    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.

    • Marked as answer by SomaSundaram R Thursday, October 8, 2015 11:56 AM
    Thursday, October 8, 2015 2:18 AM
    Moderator
  • Yes, Some other dll interrupted but it is an add-in to the word file.

    SomaSundaram R

    Thursday, October 8, 2015 1:08 PM