XLSAVEAS

Purpose:

Save the current Excel Workbook to a specified file via ActiveX Automation.

Syntax:

XLSAVEAS("filename", format, verbose)

"filename"

-

A string. The name of the destination file.

format

-

Optional. An integer, the file format of the target file. Defaults to -1, native format (XLS). See below for a list of supported formats.

verbose

-

Optional. An integer, the message flag

0:

do not display Excel messages (default)

1:

display Excel messages

Returns:

A 1 if successful, else an error.

Example:

xlinit();

xlput("A1:C10", ravel(1..30, 10));

xlsaveas("C:\temp\test.xls");

xlclear();

 

The values 1..30 are shaped into a 10x3 array and written to cells A1 through C10. The Workbook is saved in XLS format to the file C:\temp\test.xls.

Example:

xlinit();

xlput("A1:C10", ravel(1..30, 10));

xlsaveas("C:\temp\test.csv", 6);

xlclear();

 

Same as the previous example except the file is saved to C:\temp\test.csv in CSV format.

Remarks:

XLSAVEAS connects to the running instance of Excel.

 

The format parameter specifies the file format. The following formats are supported:

 

Constant

Value

Description

xlWorkbook

-4143

Microsoft Excel Workbook

xlHTML

44

Web Page

xlTemplate

17

Template

xlPlatformText

-4158

Text (Tab Delimited)

xlUnicodeText

42

Unicode Text

xlExcel5

39

Microsoft Excel 5.0/95 Workbook

xlExcel7

39

Microsoft Excel 5.0/95 Workbook

xlExcel9795

43

Microsoft Excel 97-2000 & 5.0/95 Workbook

xlCSV

6

CSV (Comma Delimited)

xlExcel4

33

Microsoft Excel 4.0 Worksheet

xlExcel3

29

Microsoft Excel 3.0 Worksheet

xlExcel2

16

Microsoft Excel 2.1 Worksheet

xl4Workbook

35

Microsoft Excel 4.0 Workbook

xlWK4

38

WK4 (1-2-3)

xlWK3FM3

32

WK3, FM3 (1-2-3)

xlWK3FM3

15

WK3 (1-2-3)

xlWK1FMT

30

WK1, FMT (1-2-3)

xlWK1ALL

31

WK1, ALL (1-2-3)

xlWK1

5

WK1 (1-2-3)

xlWKS

4

WKS (1-2-3)

xlWQ1

34

WQ1 (Quattro Pro/DOS)

xlDBF4

11

DBF 4 (dBASE IV)

xlDBF3

8

DBF 3 (dBASE III)

xlDBF2

7

DBF 2 (dBASE II)

xlTextPrinter

36

Formatted Text (Space Delimited)

xlTextMac

19

Text (Macintosh)

xlTextMSDOS

21

Text (MS-DOS)

xlCSVMac

22

CSV (Macintosh)

xlCSVMSDOS

24

CSV (MS-DOS)

xlDIF

9

DIF (Data Interchange Format)

xlSYLK

2

SYLK (Symbolic Link)

 

See XLSAVE to save to the original file.

 

See WRITETABLE to save a series as a single or multi-column table.

See Also:

WRITETABLE

XLCLEAR

XLGET

XLINIT

XLPUT

XLSAVE