Sub GetFileFormat()
Dim lFormat As Long
Dim sFormat As String
Dim wb As Workbook
Set wb = ActiveWorkbook
lFormat = wb.FileFormat
Select Case lFormat
Case xlAddIn: sFormat = "Add-in"
Case xlCSV: sFormat = "CSV"
Case xlCSVMac: sFormat = "CSV Mac"
Case xlCSVMSDOS: sFormat = "CSV MS DOS"
Case xlCSVWindows: sFormat = "CSV Windows"
Case xlCurrentPlatformText: sFormat = "Current Platform Text"
Case xlDBF2: sFormat = "DBF 2"
Case xlDBF3: sFormat = "DBF 3"
Case xlDBF4: sFormat = "DBF 4"
Case xlDIF: sFormat = "DIF"
Case xlExcel2: sFormat = "Excel 2"
Case xlExcel2FarEast: sFormat = "Excel 2 Far East"
Case xlExcel3: sFormat = "Excel 3"
Case xlExcel4: sFormat = "Excel 4"
Case xlExcel4Workbook: sFormat = "Excel 4 Workbook"
Case xlExcel5: sFormat = "Excel 5"
Case xlExcel7: sFormat = "Excel 7"
Case xlExcel9795: sFormat = "Excel 97/95"
Case xlHtml: sFormat = "HTML"
Case xlIntlAddIn: sFormat = "Int'l AddIn"
Case xlIntlMacro: sFormat = "Int'l Macro"
Case xlSYLK: sFormat = "SYLK"
Case xlTemplate: sFormat = "Template"
Case xlTextMac: sFormat = "Text Mac"
Case xlTextMSDOS: sFormat = "Text MS DOS"
Case xlTextPrinter: sFormat = "Text Printer"
Case xlTextWindows: sFormat = "Text Windows"
Case xlUnicodeText: sFormat = "Unicode Text"
Case xlWebArchive: sFormat = "Web Archive"
Case xlWJ2WD1: sFormat = "WJ2WD1"
Case xlWJ3: sFormat = "WJ3"
Case xlWJ3FJ3: sFormat = "WJ3FJ3"
Case xlWK1: sFormat = "WK1"
Case xlWK1ALL: sFormat = "WK1ALL"
Case xlWK1FMT: sFormat = "WK1FMT"
Case xlWK3: sFormat = "WK3"
Case xlWK3FM3: sFormat = "WK3FM3"
Case xlWK4: sFormat = "WK4"
Case xlWKS: sFormat = "WKS"
Case xlWorkbookNormal: sFormat = "Normal workbook"
Case xlWorks2FarEast: sFormat = "Works 2 Far East"
Case xlWQ1: sFormat = "WQ1"
Case xlXMLSpreadsheet: sFormat = "XML Spreadsheet"
Case Else: sFormat = "Unknown format code"
End Select
Debug.Print sFormat
End Sub
|