Hey, unfortunately I didn't found anything about just saving the excel worksheet with dxl in forum. I only found something with "SaveAs". I want to safe the Worksheet before closing. My approach: string err = oleMethod(objSheet, "Save") if (!null err) { print err "\n" } I m getting the error: "Problem with OLE Argument names." Thanks for your help :) Regards, Shariq
C.Shariq - Thu Nov 08 10:49:14 EST 2018 |
Re: Save Excel Worksheet The below is mostly direct from ExcelFunctions.inc, which is floating around out there. It should do what you want.
string filename //..name of your excel file here
OleAutoArgs args = null
// Modified version of checkRes from ole.inc file.
bool checkResult(string res)
{
if(res != "")
{
if(confirm("OLE method failed: \n" res "\n\n Do you wish to continue?", msgError)) { return(false); }
else { progressStop(); halt(); }
}
return(true);
}
//...
clear(args);
put(args, "FileName", filename);
if(!checkResult(oleMethod(objWorkbook, "SaveAs", args)))
{
errorBox("File SaveAs failed.");
}
|
Re: Save Excel Worksheet Hey,
thanks a lot. I thought there should be a method like only "Save" but I guess I have to use "SaveAs".
Optional: It is a little bit off topic but can somebody tell me how to add a code block? newbie :)
Regards, Shariq |
Re: Save Excel Worksheet C.Shariq - Fri Nov 09 03:07:47 EST 2018 Hey,
thanks a lot. I thought there should be a method like only "Save" but I guess I have to use "SaveAs".
Optional: It is a little bit off topic but can somebody tell me how to add a code block? newbie :)
Regards, Shariq You can add a code block by pressing the "<>" button in the reply box.
A "Save" function exists on the Workbook object, but not on the Worksheet, you could try getting the ActiveWorkbook and then call Save on it as you tried with the worksheet. |
Re: Save Excel Worksheet O.Wilkop - Fri Nov 09 08:21:41 EST 2018 You can add a code block by pressing the "<>" button in the reply box.
A "Save" function exists on the Workbook object, but not on the Worksheet, you could try getting the ActiveWorkbook and then call Save on it as you tried with the worksheet. Hey,
now I did found the button. again thanks :)
Before posting this I also tried with workbook but I get the same error. But yesterday I also found another solution by running a vba macro with dxl which save the excel file.(instead of trying to call the function "Save" or "SaveAs") Regards Shariq |