none
loosing interaction with .application object 2016 c# RRS feed

  • Question

  • I´m working on a c# application that opens a excel template, lets the user fill in some values,

    then makes some calculations and finally saves the file in a repository.

    My problem: after upgrading to 2016, I can no longer save my file, or set any properties on the application or workbook objects. My sheet objects still works fine, and I can write in my cells.

    application and workbook objects seems to be in a ignore updates state ? I can still ask values of properties but not set anything ...

    anybody else out there experienced anything similar ?

    Monday, May 23, 2016 7:47 AM

Answers

  • >>>Think I´ve looked at all propeties of the .application and .workbook objects and they both answer that all is fine., but it ignores updates, like I can ask for the workbooks Name and it answers 

    correctly, but if I try to set the Name it just ignores me. No errors, no problems, just ignores me<<<

    According to your description, Workbook.Name property is readonly, so you are not able to set Workbook name.

    For more information, click here to refer about Workbook.Name Property (Excel)

    >>>privatevoidExcel_WorkbookBeforeSave(Excel.Workbookwb, booltest, refboolcancel)

    There is a Workbook.BeforeSave event occurs before the workbook is saved.

    For more information, click here to refer about Workbook.BeforeSave Event (Excel)

    I suggest that you could provide more information about this issue, for example sample code and screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.
    • Marked as answer by David_JunFeng Thursday, June 2, 2016 5:33 AM
    Wednesday, May 25, 2016 8:36 AM

All replies

  • Hello,

    What code exactly do you use? Did you try to debug the application? What line of code causes the issue?


    [custom.development]

    Monday, May 23, 2016 6:55 PM
  • >>>My problem: after upgrading to 2016, I can no longer save my file, or set any properties on the application or workbook objects. My sheet objects still works fine, and I can write in my cells.

    application and workbook objects seems to be in a ignore updates state ? I can still ask values of properties but not set anything ...<<<

    When you open a document in Word 2016 that was created in Word 2010 or earlier, you see Compatibility Mode in the title bar of the document window. Compatibility Mode temporarily disables new or enhanced Word 2016 features so that people using Word 2010 or earlier will still have full editing capabilities. Compatibility Mode also preserves the layout of the document. Could you reproduce this issue by manual operation? Otherwise I suggest that you can convert your document to the Word 2016 file format to check this issue can be reproduced.

    For more information, click here to refer about Use Word 2016 to open documents created in earlier versions of Word

    In addition could you provide your sample code or template document, that will help us reproduce and resolve your issue.

    Thanks for your understanding.

    Tuesday, May 24, 2016 3:28 AM
  • I´ve used a standard sample, and if I run the code without the user interaction part it works just fine.

    It´s when I come back from the excel ribbon code to my c# the second time that this problem occurs.

    I get back to c# to my function:

    privatevoidExcel_WorkbookBeforeSave(Excel.Workbookwb, booltest, refboolcancel)

    Think I´ve looked at all propeties of the .application and .workbook objects and they both answer that all is fine., but it ignores updates, like I can ask for the workbooks Name and it answers correctly, but if I try to set the Name it just ignores me. No errors, no problems, just ignores me

     

    Tuesday, May 24, 2016 7:56 AM
  • Tried recreating the template in 2016, with no luck.

    (can´t post the template, it contains too much sensitive information)

    but if it was a compatibility problem, would´t I experience the same thing the first time around ?

    i.e when I´ve opened excel, loaded the template, added some data, everything is still well. I can rename my workbook or .SaveAs if I want to but, then I handover control to the user for more data, and comes back to my code when the user wants to save.

    Tuesday, May 24, 2016 8:10 AM
  • >>>Think I´ve looked at all propeties of the .application and .workbook objects and they both answer that all is fine., but it ignores updates, like I can ask for the workbooks Name and it answers 

    correctly, but if I try to set the Name it just ignores me. No errors, no problems, just ignores me<<<

    According to your description, Workbook.Name property is readonly, so you are not able to set Workbook name.

    For more information, click here to refer about Workbook.Name Property (Excel)

    >>>privatevoidExcel_WorkbookBeforeSave(Excel.Workbookwb, booltest, refboolcancel)

    There is a Workbook.BeforeSave event occurs before the workbook is saved.

    For more information, click here to refer about Workbook.BeforeSave Event (Excel)

    I suggest that you could provide more information about this issue, for example sample code and screenshot etc., that will help us reproduce and resolve it.

    Thanks for your understanding.
    • Marked as answer by David_JunFeng Thursday, June 2, 2016 5:33 AM
    Wednesday, May 25, 2016 8:36 AM