Save As function in exel

Add-in Express™ Support Service
That's what is more important than anything else

Save As function in exel
 
Kristjan H




Posts: 27
Joined: 2005-10-29
Hi

Trying to save excel workbook but no success, i mean that following command will generate different errror codes. Any ideas how to make this work:

excelapp.ActiveWorkbook.SaveAs(spath,xlnormal,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam);

Thanks,
Kris
Posted 31 Oct, 2005 06:04:54 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Kristjan,

What Delphi version do you use? Anyway, you can try the code below:


OleVariant(ExcelApp.ActiveWorkbook).SaveAs('c:MyWB.xls');


or

ExcelApp.ActiveWorkbook.SaveAs('c:MyWB.xls', EmptyParam, EmptyParam,
  EmptyParam, EmptyParam, EmptyParam, xlNoChange,
  EmptyParam, EmptyParam, EmptyParam, EmptyParam, adxLCID);

Posted 31 Oct, 2005 06:52:26 Top
Kristjan H




Posts: 27
Joined: 2005-10-29
Works fine, thanks.

Do You have any idea how to upload saved file without closing current workbook? Is there any possibility to pass opened file error?

Maybe resave?
Posted 31 Oct, 2005 14:49:47 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Kristjan,

I am afraid I do not quite understand what you need to do. Could you please describe it in other words.

Posted 02 Nov, 2005 07:11:55 Top
Kristjan H




Posts: 27
Joined: 2005-10-29
Try following command:

excell:
sPath := 'c:\lawoffice\temp\eee.xls';
ExcelApp.ActiveWorkbook.SaveAs(spath, EmptyParam, EmptyParam,EmptyParam, EmptyParam, EmptyParam, xlNoChange, EmptyParam, EmptyParam, EmptyParam, EmptyParam, adxLCID);

data := TIdMultiPartFormDataStream.Create;

failnimi:=failinimi;
///myfirstaddin_impl.AddInModule2.savetofile('test','c:\'); WONT WORK FROM UNIT2

suiMemo.lines.add(failinimi);

try
data.AddFormField('doc_state_id', vartostr(cmbDocState.editvalue));
data.AddFile('doc_file',failnimi, 'multipart/form-data');

application.ProcessMessages;
{ Call the Post method of TIdHTTP and read the result into TMemo }
postresult:=IdHTTP1.Post('http://server/'+'post/document.php', data);


Gives error as result. document should be closed before but is there way to avoid closing document?

Kris
Posted 02 Nov, 2005 16:34:20 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Kristjan,

Which line of the code raises the error? It would be very helpful, if you send me some test code so that I can compile it and see the error.

Posted 03 Nov, 2005 07:01:38 Top
Kristjan H




Posts: 27
Joined: 2005-10-29
postresult:=IdHTTP1.Post('http://server/'+'post/document.php', data);
Posted 07 Nov, 2005 15:45:58 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Kristjan,

I am afraid I can't advise anything of value.

Posted 08 Nov, 2005 07:18:47 Top