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
oExcel = CREATEOBJECT('excel.application')
cOutfile2 = 'myfilev2.xlsx'
objexcel.ActiveWorkbook.SaveAs(cOutfile2, xlOpenXMLWorkbook)

In excel.h xlOpenXMLWorkbook is 51



,"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.

Whispering Smith Ltd Head Office:61 Great Ducie Street, 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

Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to