c# - Open excel workbook but set calculations to manual -


i have tried few options none seem work, , send errors.

please let me know doing wrong

    public string main(string wbpath, string wbname)     {         string cname="";         excel.application xlapp;         excel.workbook xlwb;         excel.worksheet xlws;               xlapp = new excel.application();             xlapp.displayalerts = false;                 xlapp.calculation = excel.xlcalculation.xlcalculationmanual;       //error occurs here                       xlwb = xlapp.workbooks.open(wbpath + wbname);                          xlwb.saveas("vfile.html", microsoft.office.interop.excel.xlfileformat.xlhtml);                         cname=xlwb.fullname;                         xlwb.close();               xlapp.quit();          return cname;     } 

error code:

        {"exception hresult: 0x800a03ec"} 

you must open workbook before setting xlapp.calculation:

    static void main(string[] args)     {         string cname = "";          var xlapp = new application();          var xlwb = xlapp.workbooks.open("youpathgoeshere", type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing, type.missing);         xlapp.calculation = xlcalculation.xlcalculationmanual;           var xlws = new worksheet();          xlwb.saveas("vfile.html", microsoft.office.interop.excel.xlfileformat.xlhtml);         cname = xlwb.fullname;         xlwb.close();           xlapp.quit();       } 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -