ARAKOTONDRABESA
15 years agoContributor
Microsoft Excel ActiveWorkBook -> (Null Object)
Hi everybody!
I have to save a Excel file generate by my firm application but I have a problem: When I inspect my object oExcel -> I have ActiveWorkBook (Null Object) and ActiveWindow is null object. So I can't save my open excel file. Have you a solution? This code run with other excel file. (I verify my excel file : macro is disabled ; my excel file is not read only)
function SaveExcel(sPath)
{
var oExcel = Sys.OleObject("Excel.Application");
var oWorkBook = oExcel.ActiveWorkBook;
oWorkBook.SaveAs(sPath);
oExcel.ActiveWindow.Close();
}
thanks
I have to save a Excel file generate by my firm application but I have a problem: When I inspect my object oExcel -> I have ActiveWorkBook (Null Object) and ActiveWindow is null object. So I can't save my open excel file. Have you a solution? This code run with other excel file. (I verify my excel file : macro is disabled ; my excel file is not read only)
function SaveExcel(sPath)
{
var oExcel = Sys.OleObject("Excel.Application");
var oWorkBook = oExcel.ActiveWorkBook;
oWorkBook.SaveAs(sPath);
oExcel.ActiveWindow.Close();
}
thanks