Author | Topic: Excel Macro Translated to Xbasee ++ | |
---|---|---|
St. O. Oliver Clarke | Excel Macro Translated to Xbasee ++ on Sat, 01 Oct 2011 21:04:42 -0500 Is there a library or source for translating Excel macro to Xbase ++ code. I need help paid or otherwise with how to open through Xbase ++ a pre-configured Excel sheet; insert values in three cells of the sheet and read the result from one cell back to my Xbase application. | |
Pablo Botella | Re: Excel Macro Translated to Xbasee ++ on Sun, 02 Oct 2011 22:23:49 +0200 Hi, I think you will not have troubles to do it with automation (ActiveX) but if you need help or delegate the task, yo can send me a private email ( http://www.xbwin.com/contact.html ) and I will be happy to schedule a service for this task. Regards, Pablo Botella | |
AUGE_OHR | Re: Excel Macro Translated to Xbasee ++ on Mon, 03 Oct 2011 14:03:08 +0200 hi, look at C:\ALASKA\XPPW32\Source\samples\activex\msexcel\excel2.prg greetings by OHR Jimmy > Is there a library or source for translating Excel macro to Xbase ++ code. > I need help paid or otherwise with how to open through Xbase ++ a > pre-configured Excel sheet; insert values in three cells of the sheet and > read the result from one cell back to my Xbase application. | |
mirda | Re: Excel Macro Translated to Xbasee ++ on Mon, 03 Oct 2011 14:20:10 +0200 On Sat, 01 Oct 2011 21:04:42 -0500, St. O. Oliver Clarke wrote: > Is there a library or source for translating Excel macro to Xbase ++ > code. I need help paid or otherwise with how to open through Xbase ++ a > pre-configured Excel sheet; insert values in three cells of the sheet > and read the result from one cell back to my Xbase application. Hi, I'm using following code without any problems (this is only simplified version): Enumeration XlReferenceStyle #DEFINE xlA1 1 #DEFINE xlR1C1 -4150 opening Excel oXls := CreateObject("Excel.Application") opening XLS file oBook := oXls:Workbooks:Open(cXLSFile) using sheet oSheet := oXls:Sheets(cSheetName) writing values to excel sheet oSheet:Range(oXls:ConvertFormula("R1C1", xlR1C1, xlA1)):Value := "Data" reading values from excel sheet xData := oSheet:Range(oXls:ConvertFormula("R1C1", xlR1C1, xlA1)):Value saving changes to new file oBook:SaveAs(cTargetFile) oBook:Close(.F.) oBook := NIL oXls:quit() oXls:destroy() I hope this will help you. Damir | |
Claudio Driussi | Re: Excel Macro Translated to Xbasee ++ on Mon, 03 Oct 2011 17:28:53 +0200 Il 02/10/2011 04:04, St. O. Oliver Clarke ha scritto: > Is there a library or source for translating Excel macro to Xbase ++ > code. I need help paid or otherwise with how to open through Xbase ++ a > pre-configured Excel sheet; insert values in three cells of the sheet > and read the result from one cell back to my Xbase application. As already said ActiveX is the solution. You can also call Excel macros within the sheet. In this example I open a sheet then i attach to it a VB code snippet and i call some functions to pass data. #define vbext_ct_StdModule 1 oExcel := CreateObject("Excel.Application") oExcel:DisplayAlerts := .f. oExcel:visible := .t. oExcel:workbooks:Open('XLSFILE.xls')) t := oExcel:Application:VBE:ActiveVBProject t:VBComponents:Add(vbext_ct_StdModule) i := t:VBComponents:count() t:VBComponents(i):CodeModule:AddFromFile('XLSFILE.vba') oExcel:Application:run('PosDoc') sele mmg while .not. eof() oExcel:Application:run('FillRow',art->id,art->descr,art->n01,art->n02) skip enddo oExcel:Destroy() Hope it help Claudio Driussi |