Excel File Format enumeration. Specifies the file format when saving the worksheet.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | //==================================================================== // Function: f_xlfileformat_enumeration() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string as_name // reference string as_extension // reference string as_description //-------------------------------------------------------------------- // Returns: integer //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2022/01/08 //-------------------------------------------------------------------- // Usage: f_xlfileformat_enumeration ( string as_name, ref string as_extension, ref string as_description ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Int li_value Choose Case Upper(Trim(as_Name)) Case 'XLADDIN' li_value = 18 as_Extension = 'xla' as_Description = 'Microsoft Excel 97-2003 Add-In' Case 'XLADDIN8' li_value = 18 as_Extension = 'xla' as_Description = 'Microsoft Excel 97-2003 Add-In' Case 'XLCSV' li_value = 6 as_Extension = 'csv' as_Description = 'CSV' Case 'XLCSVMAC' li_value = 22 as_Extension = 'csv' as_Description = 'Macintosh CSV' Case 'XLCSVUTF8' li_value = 62 as_Extension = 'csv' as_Description = 'UTF8 CSV' Case 'XLCSVWINDOWS' li_value = 23 as_Extension = 'csv' as_Description = 'Windows CSV' Case 'XLCURRENTPLATFORMTEXT' li_value = -4158 as_Extension = 'txt' as_Description = 'Current Platform Text' Case 'XLDBF2' li_value = 7 as_Extension = 'dbf' as_Description = 'Dbase 2 format' Case 'XLDBF3' li_value = 8 as_Extension = 'dbf' as_Description = 'Dbase 3 format' Case 'XLDBF4' li_value = 11 as_Extension = 'dbf' as_Description = 'Dbase 4 format' Case 'XLDIF' li_value = 9 as_Extension = 'dif' as_Description = 'Data Interchange format' Case 'XLEXCEL12' li_value = 50 as_Extension = 'xlsb' as_Description = 'Excel Binary Workbook' Case 'XLEXCEL2' li_value = 16 as_Extension = 'xls' as_Description = 'Excel version 2.0 (1987)' Case 'XLEXCEL2FAREAST' li_value = 27 as_Extension = 'xls' as_Description = 'Excel version 2.0 far east (1987)' Case 'XLEXCEL3' li_value = 29 as_Extension = 'xls' as_Description = 'Excel version 3.0 (1990)' Case 'XLEXCEL4' li_value = 33 as_Extension = 'xls' as_Description = 'Excel version 4.0 (1992)' Case 'XLEXCEL4WORKBOOK' li_value = 35 as_Extension = 'xlw' as_Description = 'Excel version 4.0. Workbook format (1992)' Case 'XLEXCEL5' li_value = 39 as_Extension = 'xls' as_Description = 'Excel version 5.0 (1994)' Case 'XLEXCEL7' li_value = 39 as_Extension = 'xls' as_Description = 'Excel 95 (version 7.0)' Case 'XLEXCEL8' li_value = 56 as_Extension = 'xls' as_Description = 'Excel 97-2003 Workbook' Case 'XLEXCEL9795' li_value = 43 as_Extension = 'xls' as_Description = 'Excel version 95 and 97' Case 'XLHTM' li_value = 44 as_Extension = 'htm' as_Description = 'HTML format' Case 'XLHTML' li_value = 44 as_Extension = 'html' as_Description = 'HTML format' Case 'XLINTLADDIN' li_value = 26 as_Extension = '' //No file extension as_Description = 'International Add-In' Case 'XLINTLMACRO' li_value = 25 as_Extension = '' //No file extension as_Description = 'International Macro' Case 'XLOPENDOCUMENTSPREADSHEET' li_value = 60 as_Extension = 'ods' as_Description = 'OpenDocument Spreadsheet' Case 'XLOPENXMLADDIN' li_value = 55 as_Extension = 'xlam' as_Description = 'Open XML Add-In' Case 'XLOPENXMLSTRICTWORKBOOK' li_value = 61 as_Extension = 'xlsx' as_Description = 'Strict Open XML file' Case 'XLOPENXMLTEMPLATE' li_value = 54 as_Extension = 'xltx' as_Description = 'Open XML Template' Case 'XLOPENXMLTEMPLATE' li_value = 54 as_Extension = 'xltx' as_Description = 'Open XML Template' Case 'XLOPENXMLTEMPLATEMACROENABLED' li_value = 53 as_Extension = 'xltm' as_Description = 'Open XML Template Macro Enabled' Case 'XLOPENXMLWORKBOOK' li_value = 51 as_Extension = 'xlsx' as_Description = 'Open XML Workbook' Case 'XLOPENXMLWORKBOOKMACROENABLED' li_value = 52 as_Extension = 'xlsm' as_Description = 'Open XML Workbook Macro Enabled' Case 'XLSYLK' li_value = 2 as_Extension = 'slk' as_Description = 'Symbolic Link format' Case 'XLTEMPLATE' li_value = 17 as_Extension = 'xlt' as_Description = 'Excel Template format' Case 'XLTEMPLATE8' li_value = 17 as_Extension = 'xlt' as_Description = 'Template 8' Case 'XLTEXTMAC' li_value = 19 as_Extension = 'txt' as_Description = 'Macintosh Text' Case 'XLTEXTMSDOS' li_value = 21 as_Extension = 'txt' as_Description = 'MSDOS Text' Case 'XLTEXTPRINTER' li_value = 36 as_Extension = 'prn' as_Description = 'Printer Text' Case 'XLTEXTWINDOWS' li_value = 20 as_Extension = 'txt' as_Description = 'Windows Text' Case 'XLUNICODETEXT' li_value = 42 as_Extension = 'txt' as_Description = 'Unicode Text' Case 'XLWEBARCHIVE' li_value = 45 as_Extension = 'mht' as_Description = 'Web Archive' Case 'XLWEBARCHIVEMHTML' li_value = 45 as_Extension = 'mhtml' as_Description = 'Web Archive' Case 'XLWJ2WD1' li_value = 14 as_Extension = 'wj2' as_Description = 'Japanese 1-2-3' Case 'XLWJ3' li_value = 40 as_Extension = 'wj3' as_Description = 'Japanese 1-2-3' Case 'XLWJ3FJ3' li_value = 41 as_Extension = 'wj3' as_Description = 'Japanese 1-2-3 format' Case 'XLWK1' li_value = 5 as_Extension = 'wk1' as_Description = 'Lotus 1-2-3 format' Case 'XLWK1ALL' li_value = 31 as_Extension = 'wk1' as_Description = 'Lotus 1-2-3 format' Case 'XLWK1FMT' li_value = 30 as_Extension = 'wk1' as_Description = 'Lotus 1-2-3 format' Case 'XLWK3' li_value = 15 as_Extension = 'wk3' as_Description = 'Lotus 1-2-3 format' Case 'XLWK3FM3' li_value = 32 as_Extension = 'wk3' as_Description = 'Lotus 1-2-3 format' Case 'XLWK4' li_value = 38 as_Extension = 'wk4' as_Description = 'Lotus 1-2-3 format ' Case 'XLWKS' li_value = 4 as_Extension = 'wks' as_Description = 'Lotus 1-2-3 format' Case 'XLWORKBOOKDEFAULT' li_value = 51 as_Extension = 'xlsx' as_Description = 'Workbook default' Case 'XLWORKBOOKNORMAL' li_value = -4143 as_Extension = 'xls' as_Description = 'Workbook normal' Case 'XLWORKS2FAREAST' li_value = 28 as_Extension = 'wks' as_Description = 'Microsoft Works 2.0 far east format' Case 'XLWQ1' li_value = 34 as_Extension = 'wq1' as_Description = 'Quattro Pro format' Case 'XLXMLSPREADSHEET' li_value = 46 as_Extension = 'xml' as_Description = 'XML Spreadsheet' Case Else li_value = 0 as_Extension = '' as_Description = '' End Choose Return li_value |
Example
1 2 3 4 5 6 7 8 9 10 11 | int li_num string ls_extension, ls_description li_num = f_xlfileformat_enumeration ( "XLWORKBOOKDEFAULT", ls_extension, ls_description ) ioo_excel = CREATE OleObject li_rc = ioo_excel.ConnectToNewObject("Excel.Application") ioo_excel.workbooks.Add() ioo_excel.activeworkbook.saveas(ls_filename, li_num) ioo_excel.activeworkbook.close() ioo_excel.Application.quit ioo_excel.DisconnectObject() DESTROY ioo_excel |
Specifies the file format when saving the worksheet. from https://docs.microsoft.com/en-us/office/vba/api/excel.xlfileformat
Name | Value | Description | Extension |
---|---|---|---|
xlAddIn | 18 | Microsoft Excel 97-2003 Add-In | *.xla |
xlAddIn8 | 18 | Microsoft Excel 97-2003 Add-In | *.xla |
xlCSV | 6 | CSV | *.csv |
xlCSVMac | 22 | Macintosh CSV | *.csv |
xlCSVMSDOS | 24 | MSDOS CSV | *.csv |
xlCSVUTF8 | 62 | UTF8 CSV | *.csv |
xlCSVWindows | 23 | Windows CSV | *.csv |
xlCurrentPlatformText | -4158 | Current Platform Text | *.txt |
xlDBF2 | 7 | Dbase 2 format | *.dbf |
xlDBF3 | 8 | Dbase 3 format | *.dbf |
xlDBF4 | 11 | Dbase 4 format | *.dbf |
xlDIF | 9 | Data Interchange format | *.dif |
xlExcel12 | 50 | Excel Binary Workbook | *.xlsb |
xlExcel2 | 16 | Excel version 2.0 (1987) | *.xls |
xlExcel2FarEast | 27 | Excel version 2.0 far east (1987) | *.xls |
xlExcel3 | 29 | Excel version 3.0 (1990) | *.xls |
xlExcel4 | 33 | Excel version 4.0 (1992) | *.xls |
xlExcel4Workbook | 35 | Excel version 4.0. Workbook format (1992) | *.xlw |
xlExcel5 | 39 | Excel version 5.0 (1994) | *.xls |
xlExcel7 | 39 | Excel 95 (version 7.0) | *.xls |
xlExcel8 | 56 | Excel 97-2003 Workbook | *.xls |
xlExcel9795 | 43 | Excel version 95 and 97 | *.xls |
xlHtml | 44 | HTML format | *.htm; *.html |
xlIntlAddIn | 26 | International Add-In | No file extension |
xlIntlMacro | 25 | International Macro | No file extension |
xlOpenDocumentSpreadsheet | 60 | OpenDocument Spreadsheet | *.ods |
xlOpenXMLAddIn | 55 | Open XML Add-In | *.xlam |
xlOpenXMLStrictWorkbook | 61 (&H3D) | Strict Open XML file | *.xlsx |
xlOpenXMLTemplate | 54 | Open XML Template | *.xltx |
xlOpenXMLTemplateMacroEnabled | 53 | Open XML Template Macro Enabled | *.xltm |
xlOpenXMLWorkbook | 51 | Open XML Workbook | *.xlsx |
xlOpenXMLWorkbookMacroEnabled | 52 | Open XML Workbook Macro Enabled | *.xlsm |
xlSYLK | 2 | Symbolic Link format | *.slk |
xlTemplate | 17 | Excel Template format | *.xlt |
xlTemplate8 | 17 | Template 8 | *.xlt |
xlTextMac | 19 | Macintosh Text | *.txt |
xlTextMSDOS | 21 | MSDOS Text | *.txt |
xlTextPrinter | 36 | Printer Text | *.prn |
xlTextWindows | 20 | Windows Text | *.txt |
xlUnicodeText | 42 | Unicode Text | No file extension; *.txt |
xlWebArchive | 45 | Web Archive | *.mht; *.mhtml |
xlWJ2WD1 | 14 | Japanese 1-2-3 | *.wj2 |
xlWJ3 | 40 | Japanese 1-2-3 | *.wj3 |
xlWJ3FJ3 | 41 | Japanese 1-2-3 format | *.wj3 |
xlWK1 | 5 | Lotus 1-2-3 format | *.wk1 |
xlWK1ALL | 31 | Lotus 1-2-3 format | *.wk1 |
xlWK1FMT | 30 | Lotus 1-2-3 format | *.wk1 |
xlWK3 | 15 | Lotus 1-2-3 format | *.wk3 |
xlWK3FM3 | 32 | Lotus 1-2-3 format | *.wk3 |
xlWK4 | 38 | Lotus 1-2-3 format | *.wk4 |
xlWKS | 4 | Lotus 1-2-3 format | *.wks |
xlWorkbookDefault | 51 | Workbook default | *.xlsx |
xlWorkbookNormal | -4143 | Workbook normal | *.xls |
xlWorks2FarEast | 28 | Microsoft Works 2.0 far east format | *.wks |
xlWQ1 | 34 | Quattro Pro format | *.wq1 |
xlXMLSpreadsheet | 46 | XML Spreadsheet | *.xml |
Operation OLEObject Excel Command Powerbuilder ClickHere
Good Luck!