Or learn how to manipulate Excel as a com object and have Excel bring in the data for you into the modern sheet format.
A for loop within a for loop to get rows and columns.
On Mon, Apr 16, 2018 at 11:32 AM, Peter Cushing < pcushing@whisperingsmith.com> wrote:
On 16/04/2018 17:17, Desmond Lloyd wrote:
Good Morning,
Need to be able to copy the contents of a cursor to an Excel file, but it needs to be in the xlsx.
Am a newbie to Excel Automation and have read that you can saveas, and it will save in the latest format. Well mine doesn't. oworkbook.version shows 16. (we are running Office 365)
Tried the SweetPotato method but it errors out. Not sure why.
Would someone be kind enough to point me in the right direction, with some possible examples...
You can copy the contents of the cursor out to .xls only using the
standard COPY TO ... TYPE XL5 Then you can use automation to create an .XLSX file. I'm using office 365 but I am on version 15 so slightly older so you should be able to create an .XLSX file with your version.
#include include\excel.h TRUE=.T. FALSE=.F. oExcel = CREATEOBJECT('excel.application') oExcel.Workbooks.Open(myfile) cOutfile2 = 'myfilev2.xlsx' objexcel.ActiveWorkbook.SaveAs(cOutfile2, xlOpenXMLWorkbook)
In excel.h xlOpenXMLWorkbook is 51
HTH,
Peter
,"This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email. www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, https://maps.google.com/?q=h+Ltd+Head+Office:61+Great+Ducie+Street,&entry=gmail&source=g Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715 London Office: 101 St. Martin's Lane,London, WC2N 4AZ Tel:0207 299 7960
[excessive quoting removed by server]