At 06:34 AM 6/11/2009, John Docherty wrote:

I note that Excel 2007 gives me a warning about the file format
when opening the file, but it certainly appears to be OK.


John,

That is the result of file being saved with ".xls" extension.
However, if you save the file with ".xlsx" extension, Excel
2007 will not generate that initial -ERROR- when opening the
file.

Having said that, to automate the entire process of generating
spreadsheets via R:BASE, using the GATEWAY EXPORT with OPTION
SPECIFICATION_FILE_NAME, you can use RRegistry.RBL Plugin to
find the appropriate file extension (.xls or .xlsx).

Here's how:

-- Example
-- Start here ...
IF (CVAL('DATABASE')) <> 'RRBYW14' OR +
   (CVAL('DATABASE')) IS NULL THEN
   CONNECT RRBYW14 IDENTIFIED BY NONE
ENDIF
-- Find the default file extension and version of MS Excel
-- installed (.xlsx for MS Office Excel 2007)
CLS
PLUGIN RRegistry.RBL 'vCheckExtension|CHECK_KEY|HKCR|.xlsx|'
IF vCheckExtension = 'TRUE' THEN
   -- Create XLSX Worksheet for MS Excel 2007
   GATEWAY EXPORT XLSW Customer.XLSX +
   SELECT * FROM Customer ORDER BY Company +
   OPTION SPECIFICATION_FILE_NAME Customer.rgw +
   |SHEET_NAME Customers +
   |ACTION OPENVIEW
ELSE
   -- Create XLS Worksheet for older MS Excel
   GATEWAY EXPORT XLSW Customer.XLS +
   SELECT * FROM Customer ORDER BY Company +
   OPTION SPECIFICATION_FILE_NAME Customer.rgw +
   |SHEET_NAME Customers +
   |ACTION OPENVIEW
ENDIF
CLEAR VARIABLE vCheckExtension
RETURN
-- End here ...

That is your tip of the day!

Very Best R:egards,

Razzak.


Reply via email to