none
Getting Exception HRESULT: 0x800A03EC for MergeWorkbook() API RRS feed

  • Question

  • Suddenly I am getting exception HRESULT: 0x800A03EC for MergeWorkbook() API.

    This method works fine and client is deployed on many machines long back. Here is the code snippets 

    lobjExcelWorkBook = lobExceljApplication.Workbooks.Open(pobjFileToOpen, lobjMissing, lobjFalse, lobjMissing, lobjMissing, lobjMissing, true, lobjMissing, lobjMissing, true, lobjMissing, lobjMissing, lobjMissing, lobjMissing, lobjMissing);

    lobjExcelWorkBook.MergeWorkbook(lstrTempLocalPath);

    Where

    **pobjFileToOpen -> local file 

    **lstrTempLocalPath -> new file with different changes fetched from server. 

    I've tried all possible solutions given on different forums, but no luck. 

    Thursday, August 11, 2016 2:44 PM

Answers

  • Hi,

    The Workbook.MergeWorkbook Method is used for merging changes from one workbook into an open shared workbook.

    According to Merge copies of a shared workbook,

    To use the Compare and Merge Workbooks command, all users of the shared workbook need to save a copy of the original file and add their changes to that copy. They need to save the copy with a unique file name that differs from the original's name as well as the names of any other copies. They also need to put their copies in the same folder as the original shared workbook.

    You can only merge a shared workbook with copies made from the original. Also, you can't merge a workbook that hasn't been shared.

    Please see the following prompt. To merge the workbook, you should firstly create a shared workbook, and then the changes in copied workbook can be merged successfully.

    In your case,

    **pobjFileToOpen should be a copy of the shared workbook,

    **lstrTempLocalPath should be a shared workbook.

    For how to share a workbook, please see Use a shared workbook to collaborate

    • Marked as answer by Vijay Gawli Wednesday, August 17, 2016 10:53 AM
    Friday, August 12, 2016 8:19 AM
    Moderator
  • Hi,

    What kinds of app are you developing? An VSTO add-in or a document-level customization?

    What's your office version?

    Could you succeed in merging this two specific files manually?

    To manually achieve that, please see Merge copies of a shared workbook

    • Marked as answer by Vijay Gawli Wednesday, August 17, 2016 10:53 AM
    Friday, August 12, 2016 12:54 PM
    Moderator

All replies

  • Hi,

    The Workbook.MergeWorkbook Method is used for merging changes from one workbook into an open shared workbook.

    According to Merge copies of a shared workbook,

    To use the Compare and Merge Workbooks command, all users of the shared workbook need to save a copy of the original file and add their changes to that copy. They need to save the copy with a unique file name that differs from the original's name as well as the names of any other copies. They also need to put their copies in the same folder as the original shared workbook.

    You can only merge a shared workbook with copies made from the original. Also, you can't merge a workbook that hasn't been shared.

    Please see the following prompt. To merge the workbook, you should firstly create a shared workbook, and then the changes in copied workbook can be merged successfully.

    In your case,

    **pobjFileToOpen should be a copy of the shared workbook,

    **lstrTempLocalPath should be a shared workbook.

    For how to share a workbook, please see Use a shared workbook to collaborate

    • Marked as answer by Vijay Gawli Wednesday, August 17, 2016 10:53 AM
    Friday, August 12, 2016 8:19 AM
    Moderator
  • Hi Celeste, Thank you for your reply. 

    I've checked that both above workbooks are shared. 

    pobjFileToOpen is a copy of user's open document  on which user is currently working and lstrTempLocalPath file is fetch from the server in same folder with different name. 

    As I've already mentioned that this code is working since last two years. 

    Friday, August 12, 2016 11:10 AM
  • Hi,

    What kinds of app are you developing? An VSTO add-in or a document-level customization?

    What's your office version?

    Could you succeed in merging this two specific files manually?

    To manually achieve that, please see Merge copies of a shared workbook

    • Marked as answer by Vijay Gawli Wednesday, August 17, 2016 10:53 AM
    Friday, August 12, 2016 12:54 PM
    Moderator
  • Hi Celeste,

    Fixed the issue. You are right that my workbook (pobjFileToOpen ) is not shareable.  I've checked the code, we are saving with Excel.XlSaveAsAccessMode.xlNoChange . After changing to xlShared mode, client is not throwing the exception. 

    We are developing VSTO add-in real time coauthoring. I am not sure how its was working previously as client (VSTO add-in) is deployed since 2 yrs.  

    Thank you for your valuable  response once again.

    -Vijay G.

    Monday, August 15, 2016 2:20 AM
  • Hi,

    I am very glad that you have resolved the issue. And thanks for sharing the solution.

    If there is any issues, please feel free to ask us, we are willing to offer help.

    Regards,

    Celeste 

    • Marked as answer by Vijay Gawli Wednesday, August 17, 2016 10:52 AM
    • Unmarked as answer by Vijay Gawli Wednesday, August 17, 2016 10:53 AM
    Monday, August 15, 2016 2:42 AM
    Moderator