Announcement

Collapse

PM and other Problems

We seem to be experiencing system-wide problems with Personal Messages, Notifications, and other secondary systems. Our Forum Hosting company has been alerted. This DOES affect the ability of Admins to respond to outstanding PMs, forum-access requests, and other items as well; please be patient.
See more
See less

Reading Excel BIFF Files Part1: Enumerating Workbook Sections

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading Excel BIFF Files Part1: Enumerating Workbook Sections

    This example enumerates all of the sections of a BIFF file and dumps them to a text file. Worksheet names are also extracted.

    Requires: Jose Roca's include files

    References:
    Microsoft BIFF Docs
    OpenOffice Docs
    MSDN
    Jose Roca 1 / Jose Roca 2

    I am currently writing routines to read XL files without the need to use Excel automation. I will post more here as I progress. All data for enumerating section IDs are taken directly from MS Docs and OO.org docs.

    It does not surprise me that even after combining knowledge from both documents I still get an undefined section. &H01BA seems to have something to do with VBA modules. I can't find reference to it anywhere. I doubt I'll investigate it further since I do not need it.

    Code:
    ' ########################################################################################
    ' Enumerates the sections of an Excel BIFF file and also pulls worksheet names.
    ' ########################################################################################
    
    #COMPILE EXE
    #DIM ALL
    #INCLUDE ONCE "propidl.inc"
    #INCLUDE ONCE "OLE2UTILS.inc"
    
    TYPE tIdentifier
        idNumber AS WORD
        szSize AS WORD
    END TYPE
    
    'Beginning of file for BIFF 5-7
    TYPE tBOF57
        vers AS WORD
        dt AS WORD
        rupBuild AS WORD
        rupYear AS WORD
    END TYPE
    
    'Beginning of file for BIFF 8
    TYPE tBOF8
        vers AS WORD
        dt AS WORD
        rupBuild AS WORD
        rupYear AS WORD
        bfh AS DWORD
        sfo AS DWORD
    END TYPE
    
    'This record stores the sheet name, sheet type, and stream position.
    TYPE tBoundSheet
        lbPlyPos AS DWORD 'Stream position of the start of the BOF record for the sheet
        grbit AS WORD     'Option flags
        'The following are made redundant with BIFF8 unicode strings.
        'They should be processed separately
        'cch as BYTE       'Length of the sheet name (in characters)
        'rgch as STRING    'Sheet name (grbit/rgb fields of Unicode String)
    END TYPE
    
    'A BiffString formatting run
    TYPE tRun
        charOffset AS WORD 'zero based starting character of the run
        fontIndex AS WORD  'zero based font record index
    END TYPE
    
    'SST: Shared String Table (FCh)
    TYPE tSharedStringTable
        cstTotal AS DWORD  'Total number of strings in the shared string table and extended string table (EXTSST record)
        cstUnique AS DWORD 'Number of unique strings in the shared string table
        'rgb               'Array of unique unicode strings.
    END TYPE
    
    ' ========================================================================================
    ' Main
    ' ========================================================================================
    FUNCTION PBMAIN
    
        DIM hr AS LONG
        DIM pStorage AS IStorage
        DIM pStream AS IStream
        DIM wszName AS STRING
        DIM qNewPos AS QUAD
        DIM cbRead AS DWORD
        DIM cbSize AS QUAD
        DIM BiffVersion AS BYTE
        DIM Identifier AS tIdentifier
        DIM BoundSheet AS tBoundSheet
        DIM sst AS tSharedStringTable
        DIM sheetName AS STRING
        DIM seekDistance AS QUAD
        DIM i AS LONG
    
        wszName = UCODE$("Test.xls")
        hr = StgOpenStorage(STRPTR(wszName), NOTHING, _
            %STGM_READ OR %STGM_SHARE_EXCLUSIVE, _
            0, %NULL, pStorage)
        IF FAILED(hr) THEN
          MSGBOX "StgOpenStorage failure: " & HEX$(hr)
          EXIT FUNCTION
        END IF
    
        wszName = UCODE$("Workbook")
        hr = pStorage.OpenStream(STRPTR(wszName), 0, %STGM_READ OR %STGM_SHARE_EXCLUSIVE, 0, pStream)
        IF FAILED(hr) THEN
            wszName = UCODE$("Book")
            hr = pStorage.OpenStream(STRPTR(wszName), 0, %STGM_READ OR %STGM_SHARE_EXCLUSIVE, 0, pStream)
            IF FAILED(hr) THEN
                MSGBOX "IStorage.OpenStream failure: " & HEX$(hr)
                EXIT FUNCTION
            END IF
        END IF
    
        cbSize = IStream_GetSize(pStream)
    
        OPEN "out.txt" FOR OUTPUT ACCESS WRITE AS #1
    
        DO UNTIL qNewPos + Identifier.szSize > cbSize
            hr = pStream.Read(VARPTR(Identifier), SIZEOF(Identifier), cbRead)
    
            'Grab biff version
            IF LO(BYTE, Identifier.idNumber) = &H09 THEN
                BiffVersion = HI(BYTE, Identifier.idNumber)
            END IF
    
            IF Identifier.idNumber = &H85 THEN 'BoundSheet info
                hr = pStream.Read(VARPTR(BoundSheet), SIZEOF(BoundSheet), cbRead)
                sheetName = ReadBiffString(1, BiffVersion, pStream)
                PRINT #1, "Identifier: " & IdToName$(Identifier.idNumber) & " - Size: " & FORMAT$(Identifier.szSize) & " - WorksheetName: " & sheetName
            ELSEIF Identifier.idNumber = &HFC THEN 'Shared String Table
                PRINT #1, "Identifier: " & IdToName$(Identifier.idNumber) & " - Size: " & FORMAT$(Identifier.szSize)
                hr = pStream.Read(VARPTR(sst), SIZEOF(sst), cbRead)
                FOR i = 1 TO sst.cstUnique
                    PRINT #1, ReadBiffString(2, BiffVersion, pStream)
                NEXT
            ELSE
                PRINT #1, "Identifier: " & IdToName$(Identifier.idNumber) & " - Size: " & FORMAT$(Identifier.szSize)
                seekDistance = Identifier.szSize
                hr = pStream.Seek(seekDistance, %STREAM_SEEK_CUR, qNewPos)
            END IF
        LOOP
    
        CLOSE #1
    
        pStream = NOTHING
        pStorage = NOTHING
    END FUNCTION
    ' ========================================================================================
    
    'Note: As of yet ruch and extended strings are not tested, but should work since they follow MS documentation.
    FUNCTION ReadBiffString(BYVAL SizeOfCch AS DWORD, BYVAL BiffVersion AS BYTE, BYVAL pStream AS IStream) AS STRING
        DIM hr AS LONG
        DIM cbRead AS DWORD
        DIM qNewPos AS QUAD
        DIM cc1 AS BYTE
        DIM cch AS WORD         'Count of characters in the string (Note: this is the number of chars, NOT bytes)
        DIM grbit AS BYTE       'Option flags (only used in BIFF8)
        DIM sRgb AS STRING      'Array of string characters and formatting runs
        DIM fHighByte AS BYTE   '=0 if all the characters in the string have a high byte of 00h
                                'and only the low bytes are saved in the file (compressed)
                                '=1 if at least one character in the string has a nonzero high byte and therefore
                                'all characters in the string are saved as double-byte characters (not compressed)
        DIM fExtSt AS BYTE      'Extended string flag
        DIM fRichSt AS BYTE         'Rich string flag
        DIM cchExtRst AS DWORD  'Length of ExtRst data
        DIM numRuns AS WORD         'The number of formatting runs in the BiffString
        'dim runs() as tRun         'The formatting runs
        'dim i as word
    
        IF SizeOfCch = 1 THEN
            hr = pStream.Read(VARPTR(cc1), SIZEOF(cc1), cbRead)
            cch = cc1
        ELSE
            hr = pStream.Read(VARPTR(cch), SIZEOF(cch), cbRead)
        END IF
    
        IF BiffVersion < &H08 THEN
            FUNCTION = IStream_ReadText(pStream, CLNG(cch))
        ELSE
            hr = pStream.Read(VARPTR(grbit), SIZEOF(grbit), cbRead)
            SELECT CASE grbit
                CASE &H00 'the BiffString is compressed unicode
                    FUNCTION = IStream_ReadText(pStream, CLNG(cch))
                CASE &H01 'the BiffString is Unicode
                    FUNCTION = ACODE$(IStream_ReadText(pStream, CLNG(cch * 2)))
                CASE ELSE
                    fHighByte = BIT(grbit, 0)
                    fExtSt    = BIT(grbit, 2)
                    fRichSt   = BIT(grbit, 3)
    
                    IF fExtSt = 0 THEN
                        'The BiffString is a rich string that contains a series of runs
                        hr = pStream.Read(VARPTR(numRuns), SIZEOF(numRuns), cbRead)
                        'redim runs(numRuns) as tRun
    
                        IF fHighByte = 0 THEN
                            'the BiffString is compressed unicode
                            FUNCTION = IStream_ReadText(pStream, CLNG(cch))
                        ELSE
                            'the BiffString is Unicode
                            FUNCTION = ACODE$(IStream_ReadText(pStream, CLNG(cch * 2)))
                        END IF
    
                        'Read in all of the run data
                        'for i = 0 to numRuns - 1
                        '   hr = pStream.Read(varptr(runs(i)), sizeof(runs(i)), cbRead)
                        'NEXT
                        'Since we are not processing the formatting code, just bypass it
                        hr = pStream.Seek(CQUD(numRuns * 4), %STREAM_SEEK_CUR, qNewPos)
                    ELSE
                        'The BiffString is an Extended String which contains some undocumented features
                        IF fRichSt = 1 THEN
                            'The BiffString does contain formatting runs
                            hr = pStream.Read(VARPTR(numRuns), SIZEOF(numRuns), cbRead)
                            'redim runs(numRuns) as tRun
                        END IF
    
                        hr = pStream.Read(VARPTR(cchExtRst), SIZEOF(cchExtRst), cbRead)
    
                        IF fHighByte = 0 THEN
                            'the BiffString is compressed unicode
                            FUNCTION = IStream_ReadText(pStream, CLNG(cch))
                        ELSE
                            'the BiffString is Unicode
                            FUNCTION = IStream_ReadText(pStream, CLNG(cch * 2))
                        END IF
    
                        IF fRichSt = 1 THEN
                            'Read in all of the run data
                            'for i = 0 to numRuns - 1
                            '   hr = pStream.Read(varptr(runs(i)), sizeof(runs(i)), cbRead)
                            'NEXT
                            'Since we are not processing the formatting code, just bypass it
                            hr = pStream.Seek(CQUD(numRuns * 4), %STREAM_SEEK_CUR, qNewPos)
                        END IF
    
                        'Bypass undocumented ExtRst data
                        hr = pStream.Seek(CQUD(cchExtRst), %STREAM_SEEK_CUR, qNewPos)
                    END IF
            END SELECT
        END IF
    END FUNCTION
    
    FUNCTION IdToName(IdNumber AS WORD) AS STRING
    
        '&H42 shows up twice in the MS docs. The best I can gather is that CodePage shows in the
        'header info once, and CodeName can show after that for each worksheet if needed.
        STATIC CodeNamePageFlag AS LONG
    
    'According to the BIFF specification on page 11 "File Format Versions:"
    '    In BIFF4 and earlier versions, various records (other than the BOF record)
    '    have version information specified in the high-order byte of their record numbers
    'Of course, they don't specify which ones have this version number thrown in. Checking
    'the open office documents reveal only certain ones which have been encountered with
    'the version info. We check for those first.
    
        SELECT CASE IdNumber
            ''--------------------------------------------------------
            ''The following have optional version information
            ''--------------------------------------------------------
            CASE &H00, &H200
                FUNCTION = "DIMENSIONS: Cell Table Size"
            CASE &H01, &H201
                FUNCTION = "BLANK: Cell Value, Blank Cell"
            CASE &H03, &H203
                FUNCTION = "NUMBER: Cell Value, Floating-Point Number"
            CASE &H04, &H204
                FUNCTION = "LABEL: Cell Value, String Constant"
            CASE &H05, &H205
                FUNCTION = "BOOLERR: Cell Value, Boolean or Error"
            CASE &H07, &H207
                FUNCTION = "STRING: String Value of a Formula"
            CASE &H08, &H208
                FUNCTION = "ROW: Describes a Row"
            CASE &H09, &H209, &H409, &H809
                FUNCTION = "BOF: Beginning of File"
            CASE &H0B, &H20B
                FUNCTION = "INDEX: Index Record"
            CASE &H18, &H218
                FUNCTION = "NAME: Defined Name"
            CASE &H1E, &H41E
                FUNCTION = "FORMAT: Number Format"
            CASE &H56 'This one only shows up in OO.org docs...
                FUNCTION = "BUILTINFMTCOUNT"
            CASE &H21, &H221
                FUNCTION = "ARRAY: Array-Entered Formula"
            CASE &H23, &H223
                FUNCTION = "EXTERNNAME: Externally Referenced Name"
            CASE &H25, &H225
                FUNCTION = "DEFAULTROWHEIGHT: Default Row Height"
            CASE &H31, &H231
                FUNCTION = "FONT: Font Description"
            CASE &H36, &H236
                FUNCTION = "TABLE: Data Table"
            CASE &H3E, &H23E
                FUNCTION = "WINDOW2: Sheet Window Information"
            CASE &H43, &H243, &H443, &H843
                FUNCTION = "XF: Extended Format"
            CASE &H7E, &H27E 'Listed in MS docs as 7Eh and OO.org as 027Eh. Compensate for both.
                FUNCTION = "RK: Cell Value, RK Number"
    
            ''--------------------------------------------------------
            ''The following do not have optional version information
            ''--------------------------------------------------------
            CASE &H0A
                FUNCTION = "EOF: End of File"
            CASE &H0C
                FUNCTION = "CALCCOUNT: Iteration Count"
            CASE &H0D
                FUNCTION = "CALCMODE: Calculation Mode"
            CASE &H0E
                FUNCTION = "PRECISION: Precision"
            CASE &H0F
                FUNCTION = "REFMODE: Reference Mode"
            CASE &H10
                FUNCTION = "DELTA: Iteration Increment"
            CASE &H11
                FUNCTION = "ITERATION: Iteration Mode"
            CASE &H12
                FUNCTION = "PROTECT: Protection Flag"
            CASE &H13
                FUNCTION = "PASSWORD: Protection Password"
            CASE &H14
                FUNCTION = "HEADER: Print Header on Each Page"
            CASE &H15
                FUNCTION = "FOOTER: Print Footer on Each Page"
            CASE &H16
                FUNCTION = "EXTERNCOUNT: Number of External References"
            CASE &H17
                FUNCTION = "EXTERNSHEET: External Reference"
            CASE &H19
                FUNCTION = "WINDOWPROTECT: Windows Are Protected"
            CASE &H1A
                FUNCTION = "VERTICALPAGEBREAKS: Explicit Column Page Breaks"
            CASE &H1B
                FUNCTION = "HORIZONTALPAGEBREAKS: Explicit Row Page Breaks"
            CASE &H1C
                FUNCTION = "NOTE: Comment Associated with a Cell"
            CASE &H1D
                FUNCTION = "SELECTION: Current Selection"
            CASE &H22
                FUNCTION = "1904: 1904 Date System"
            CASE &H26
                FUNCTION = "LEFTMARGIN: Left Margin Measurement"
            CASE &H27
                FUNCTION = "RIGHTMARGIN: Right Margin Measurement"
            CASE &H28
                FUNCTION = "TOPMARGIN: Top Margin Measurement"
            CASE &H29
                FUNCTION = "BOTTOMMARGIN: Bottom Margin Measurement"
            CASE &H2A
                FUNCTION = "PRINTHEADERS: Print Row/Column Labels"
            CASE &H2B
                FUNCTION = "PRINTGRIDLINES: Print Gridlines Flag"
            CASE &H2F
                FUNCTION = "FILEPASS: File Is Password-Protected"
            CASE &H3C
                FUNCTION = "CONTINUE: Continues Long Records"
            CASE &H3D
                FUNCTION = "WINDOW1: Window Information"
            CASE &H40
                FUNCTION = "BACKUP: Save Backup Version of the File"
            CASE &H41
                FUNCTION = "PANE: Number of Panes and Their Position"
            CASE &H42
                IF CodeNamePageFlag=0 THEN
                    FUNCTION = "CODEPAGE: Default Code Page"
                    CodeNamePageFlag = 1
                ELSE
                    FUNCTION = "CODENAME: VBE Object Name"
                END IF
            CASE &H4D
                FUNCTION = "PLS: Environment-Specific Print Record"
            CASE &H50
                FUNCTION = "DCON: Data Consolidation Information"
            CASE &H51
                FUNCTION = "DCONREF: Data Consolidation References"
            CASE &H52
                FUNCTION = "DCONNAME: Data Consolidation Named References"
            CASE &H55
                FUNCTION = "DEFCOLWIDTH: Default Width for Columns"
            CASE &H59
                FUNCTION = "XCT: CRN Record Count"
            CASE &H5A
                FUNCTION = "CRN: Nonresident Operands"
            CASE &H5B
                FUNCTION = "FILESHARING: File-Sharing Information"
            CASE &H5C
                FUNCTION = "WRITEACCESS: Write Access User Name"
            CASE &H5D
                FUNCTION = "OBJ: Describes a Graphic Object"
            CASE &H5E
                FUNCTION = "UNCALCED: Recalculation Status"
            CASE &H5F
                FUNCTION = "SAVERECALC: Recalculate Before Save"
            CASE &H60
                FUNCTION = "TEMPLATE: Workbook Is a Template"
            CASE &H63
                FUNCTION = "OBJPROTECT: Objects Are Protected"
            CASE &H7D
                FUNCTION = "COLINFO: Column Formatting Information"
            CASE &H7E
                FUNCTION = "RK: Cell Value, RK Number"
            CASE &H7F
                FUNCTION = "IMDATA: Image Data"
            CASE &H80
                FUNCTION = "GUTS: Size of Row and Column Gutters"
            CASE &H81
                FUNCTION = "WSBOOL: Additional Workspace Information"
            CASE &H82
                FUNCTION = "GRIDSET: State Change of Gridlines Option"
            CASE &H83
                FUNCTION = "HCENTER: Center Between Horizontal Margins"
            CASE &H84
                FUNCTION = "VCENTER: Center Between Vertical Margins"
            CASE &H85
                FUNCTION = "BOUNDSHEET: Sheet Information"
            CASE &H86
                FUNCTION = "WRITEPROT: Workbook Is Write-Protected"
            CASE &H87
                FUNCTION = "ADDIN: Workbook Is an Add-in Macro"
            CASE &H88
                FUNCTION = "EDG: Edition Globals"
            CASE &H89
                FUNCTION = "PUB: Publisher"
            CASE &H8C
                FUNCTION = "COUNTRY: Default Country and WIN.INI Country"
            CASE &H8D
                FUNCTION = "HIDEOBJ: Object Display Options"
            CASE &H90
                FUNCTION = "SORT: Sorting Options"
            CASE &H91
                FUNCTION = "SUB: Subscriber"
            CASE &H92
                FUNCTION = "PALETTE: Color Palette Definition"
            CASE &H94
                FUNCTION = "LHRECORD: .WK? File Conversion Information"
            CASE &H95
                FUNCTION = "LHNGRAPH: Named Graph Information"
            CASE &H96
                FUNCTION = "SOUND: Sound Note"
            CASE &H98
                FUNCTION = "LPR: Sheet Was Printed Using LINE.PRINT("
            CASE &H99
                FUNCTION = "STANDARDWIDTH: Standard Column Width"
            CASE &H9A
                FUNCTION = "FNGROUPNAME: Function Group Name"
            CASE &H9B
                FUNCTION = "FILTERMODE: Sheet Contains Filtered List"
            CASE &H9C
                FUNCTION = "FNGROUPCOUNT: Built-in Function Group Count"
            CASE &H9D
                FUNCTION = "AUTOFILTERINFO: Drop-Down Arrow Count"
            CASE &H9E
                FUNCTION = "AUTOFILTER: AutoFilter Data"
            CASE &HA0
                FUNCTION = "SCL: Window Zoom Magnification"
            CASE &HA1
                FUNCTION = "SETUP: Page Setup"
            CASE &HA9
                FUNCTION = "COORDLIST: Polygon Object Vertex Coordinates"
            CASE &HAB
                FUNCTION = "GCW: Global Column-Width Flags"
            CASE &HAE
                FUNCTION = "SCENMAN: Scenario Output Data"
            CASE &HAF
                FUNCTION = "SCENARIO: Scenario Data"
            CASE &HB0
                FUNCTION = "SXVIEW: View Definition"
            CASE &HB1
                FUNCTION = "SXVD: View Fields"
            CASE &HB2
                FUNCTION = "SXVI: View Item"
            CASE &HB4
                FUNCTION = "SXIVD: Row/Column Field IDs"
            CASE &HB5
                FUNCTION = "SXLI: Line Item Array"
            CASE &HB6
                FUNCTION = "SXPI: Page Item"
            CASE &HB8
                FUNCTION = "DOCROUTE: Routing Slip Information"
            CASE &HB9
                FUNCTION = "RECIPNAME: Recipient Name"
            CASE &HBC
                FUNCTION = "SHRFMLA: Shared Formula"
            CASE &HBD
                FUNCTION = "MULRK: Multiple RK Cells"
            CASE &HBE
                FUNCTION = "MULBLANK: Multiple Blank Cells"
            CASE &HC1
                FUNCTION = "MMS: ADDMENU/DELMENU Record Group Count"
            CASE &HC2
                FUNCTION = "ADDMENU: Menu Addition"
            CASE &HC3
                FUNCTION = "DELMENU: Menu Deletion"
            CASE &HC5
                FUNCTION = "SXDI: Data Item"
            CASE &HC6
                FUNCTION = "SXDB: PivotTable Cache Data"
            CASE &HCD
                FUNCTION = "SXSTRING: String"
            CASE &HD0
                FUNCTION = "SXTBL: Multiple Consolidation Source Info"
            CASE &HD1
                FUNCTION = "SXTBRGIITM: Page Item Name Count"
            CASE &HD2
                FUNCTION = "SXTBPG: Page Item Indexes"
            CASE &HD3
                FUNCTION = "OBPROJ: Visual Basic Project"
            CASE &HD5
                FUNCTION = "SXIDSTM: Stream ID"
            CASE &HD6
                FUNCTION = "RSTRING: Cell with Character Formatting"
            CASE &HD7
                FUNCTION = "DBCELL: Stream Offsets"
            CASE &HDA
                FUNCTION = "BOOKBOOL: Workbook Option Flag"
            CASE &HDC
                FUNCTION = "PARAMQRY: Query Parameters"
            CASE &HDC
                FUNCTION = "SXEXT: External Source Information"
            CASE &HDD
                FUNCTION = "SCENPROTECT: Scenario Protection"
            CASE &HDE
                FUNCTION = "OLESIZE: Size of OLE Object"
            CASE &HDF
                FUNCTION = "UDDESC: Description String for Chart Autoformat"
            CASE &HE0
                FUNCTION = "XF: Extended Format"
            CASE &HE1
                FUNCTION = "INTERFACEHDR: Beginning of User Interface Records"
            CASE &HE2
                FUNCTION = "INTERFACEEND: End of User Interface Records"
            CASE &HE3
                FUNCTION = "SXVS: View Source"
            CASE &HE5
                FUNCTION = "MERGECELLS: Merged Cells"
            CASE &HEA
                FUNCTION = "TABIDCONF: Sheet Tab ID of Conflict History"
            CASE &HEB
                FUNCTION = "MSODRAWINGGROUP: Microsoft Office Drawing Group"
            CASE &HEC
                FUNCTION = "MSODRAWING: Microsoft Office Drawing"
            CASE &HEF 'Only shows up in OO.org docs.
                FUNCTION = "PHONETIC"
            CASE &HED
                FUNCTION = "MSODRAWINGSELECTION: Microsoft Office Drawing Selection"
            CASE &HF0
                FUNCTION = "SXRULE: PivotTable Rule Data"
            CASE &HF1
                FUNCTION = "SXEX: PivotTable View Extended Information"
            CASE &HF2
                FUNCTION = "SXFILT: PivotTable Rule Filter"
            CASE &HF4
                FUNCTION = "SXDXF: Pivot Table Formatting"
            CASE &HF5
                FUNCTION = "SXITM: Pivot Table Item Indexes"
            CASE &HF6
                FUNCTION = "SXNAME: PivotTable Name"
            CASE &HF7
                FUNCTION = "SXSELECT: PivotTable Selection Information"
            CASE &HF8
                FUNCTION = "SXPAIR: PivotTable Name Pair"
            CASE &HF9
                FUNCTION = "SXFMLA: Pivot Table Parsed Expression"
            CASE &HFB
                FUNCTION = "SXFORMAT: PivotTable Format Record"
            CASE &HFC
                FUNCTION = "SST: Shared String Table"
            CASE &HFD
                FUNCTION = "LABELSST: Cell Value, String Constant/SST"
            CASE &HFF
                FUNCTION = "EXTSST: Extended Shared String Table"
            CASE &H100
                FUNCTION = "SXVDEX: Extended PivotTable View Fields"
            CASE &H103
                FUNCTION = "SXFORMULA: PivotTable Formula Record"
            CASE &H122
                FUNCTION = "SXDBEX: PivotTable Cache Data"
            CASE &H13D
                FUNCTION = "TABID: Sheet Tab Index Array"
            CASE &H160
                FUNCTION = "USESELFS: Natural Language Formulas Flag"
            CASE &H161
                FUNCTION = "DSF: Double Stream File"
            CASE &H162
                FUNCTION = "XL5MODIFY: Flag for DSF"
            CASE &H1A5
                FUNCTION = "FILESHARING2: File-Sharing Information for Shared Lists"
            CASE &H1A9
                FUNCTION = "USERBVIEW: Workbook Custom View Settings"
            CASE &H1AA
                FUNCTION = "USERSVIEWBEGIN: Custom View Settings"
            CASE &H1AB
                FUNCTION = "USERSVIEWEND: End of Custom View Records"
            CASE &H1AD
                FUNCTION = "QSI: External Data Range"
            CASE &H1AE
                FUNCTION = "SUPBOOK: Supporting Workbook"
            CASE &H1AF
                FUNCTION = "PROT4REV: Shared Workbook Protection Flag"
            CASE &H1B0
                FUNCTION = "CONDFMT: Conditional Formatting Range Information"
            CASE &H1B1
                FUNCTION = "CF: Conditional Formatting Conditions"
            CASE &H1B2
                FUNCTION = "DVAL: Data Validation Information"
            CASE &H1B5
                FUNCTION = "DCONBIN: Data Consolidation Information"
            CASE &H1B6
                FUNCTION = "TXO: Text Object"
            CASE &H1B7
                FUNCTION = "REFRESHALL: Refresh Flag"
            CASE &H1B8
                FUNCTION = "HLINK: Hyperlink"
            CASE &H1BB
                FUNCTION = "SXFDBTYPE: SQL Datatype Identifier"
            CASE &H1BC
                FUNCTION = "PROT4REVPASS: Shared Workbook Protection Password"
            CASE &H1BE
                FUNCTION = "DV: Data Validation Criteria"
            CASE &H1C0
                FUNCTION = "EXCEL9FILE: Excel 9 File"
            CASE &H1C1
                FUNCTION = "RECALCID: Recalc Information"
            CASE &H293
                FUNCTION = "STYLE: Style Information"
            CASE &H406
                FUNCTION = "FORMULA: Cell Formula"
            CASE &H800
                FUNCTION = "HLINKTOOLTIP: Hyperlink Tooltip"
            CASE &H801
                FUNCTION = "WEBPUB: Web Publish Item"
            CASE &H802
                FUNCTION = "QSISXTAG: PivotTable and Query Table Extensions"
            CASE &H803
                FUNCTION = "DBQUERYEXT: Database Query Extensions"
            CASE &H804
                FUNCTION = "EXTSTRING: FRT String"
            CASE &H805
                FUNCTION = "TXTQUERY: Text Query Information"
            CASE &H806
                FUNCTION = "QSIR: Query Table Formatting"
            CASE &H807
                FUNCTION = "QSIF: Query Table Field Formatting"
            CASE &H80A
                FUNCTION = "OLEDBCONN: OLE Database Connection"
            CASE &H80B
                FUNCTION = "WOPT: Web Options"
            CASE &H80C
                FUNCTION = "SXVIEWEX: Pivot Table OLAP Extensions"
            CASE &H80D
                FUNCTION = "SXTH: PivotTable OLAP Hierarchy"
            CASE &H80E
                FUNCTION = "SXPIEX: OLAP Page Item Extensions"
            CASE &H80F
                FUNCTION = "SXVDTEX: View Dimension OLAP Extensions"
            CASE &H810
                FUNCTION = "SXVIEWEX9: Pivot Table Extensions"
            CASE &H812
                FUNCTION = "CONTINUEFRT: Continued FRT"
            CASE &H813
                FUNCTION = "REALTIMEDATA: Real-Time Data (RTD)"
            CASE &H862
                FUNCTION = "SHEETEXT: Extra Sheet Info"
            CASE &H863
                FUNCTION = "BOOKEXT: Extra Book Info"
            CASE &H864
                FUNCTION = "SXADDL: Pivot Table Additional Info"
            CASE &H865
                FUNCTION = "CRASHRECERR: Crash Recovery Error"
            CASE &H866
                FUNCTION = "HFPicture: Header / Footer Picture"
            CASE &H867
                FUNCTION = "FEATHEADR: Shared Feature Header"
            CASE &H868
                FUNCTION = "FEAT: Shared Feature Record"
            CASE &H86A
                FUNCTION = "DATALABEXT: Chart Data Label Extension"
            CASE &H86B
                FUNCTION = "DATALABEXTCONTENTS: Chart Data Label Extension Contents"
            CASE &H86C
                FUNCTION = "CELLWATCH: Cell Watch"
            CASE &H86d
                FUNCTION = "FEATINFO: Shared Feature Info Record"
            CASE &H871
                FUNCTION = "FEATHEADR11: Shared Feature Header 11"
            CASE &H872
                FUNCTION = "FEAT11: Shared Feature 11 Record"
            CASE &H873
                FUNCTION = "FEATINFO11: Shared Feature Info 11 Record"
            CASE &H874
                FUNCTION = "DROPDOWNOBJIDS: Drop Down Object"
            CASE &H875
                FUNCTION = "CONTINUEFRT11: Continue FRT 11"
            CASE &H876
                FUNCTION = "DCONN: Data Connection"
            CASE &H877
                FUNCTION = "LIST12: Extra Table Data Introduced in Excel 2007"
            CASE &H878
                FUNCTION = "FEAT12: Shared Feature 12 Record"
            CASE &H879
                FUNCTION = "CONDFMT12: Conditional Formatting Range Information 12"
            CASE &H87A
                FUNCTION = "CF12: Conditional Formatting Condition 12"
            CASE &H87B
                FUNCTION = "CFEX: Conditional Formatting Extension"
            CASE &H87C
                FUNCTION = "XFCRC: XF Extensions Checksum"
            CASE &H87D
                FUNCTION = "XFEXT: XF Extension"
            CASE &H87E
                FUNCTION = "EZFILTER12: AutoFilter Data Introduced in Excel 2007"
            CASE &H87F
                FUNCTION = "CONTINUEFRT12: Continue FRT 12"
            CASE &H881
                FUNCTION = "SXADDL12: Additional Workbook Connections Information"
            CASE &H884
                FUNCTION = "MDTINFO: Information about a Metadata Type"
            CASE &H885
                FUNCTION = "MDXSTR: MDX Metadata String"
            CASE &H886
                FUNCTION = "MDXTUPLE: Tuple MDX Metadata"
            CASE &H887
                FUNCTION = "MDXSET: Set MDX Metadata"
            CASE &H888
                FUNCTION = "MDXPROP: Member Property MDX Metadata"
            CASE &H889
                FUNCTION = "MDXKPI: Key Performance Indicator MDX Metadata"
            CASE &H88A
                FUNCTION = "MDTB: Block of Metadata Records"
            CASE &H88B
                FUNCTION = "PLV: Page Layout View Settings in Excel 2007"
            CASE &H88C
                FUNCTION = "COMPAT12: Compatibility Checker 12"
            CASE &H88D
                FUNCTION = "DXF: Differential XF"
            CASE &H88E
                FUNCTION = "TABLESTYLES: Table Styles"
            CASE &H88F
                FUNCTION = "TABLESTYLE: Table Style"
            CASE &H890
                FUNCTION = "TABLESTYLEELEMENT: Table Style Element"
            CASE &H892
                FUNCTION = "STYLEEXT: Named Cell Style Extension"
            CASE &H893
                FUNCTION = "NAMEPUBLISH: Publish To Excel Server Data for Name"
            CASE &H894
                FUNCTION = "NAMECMT: Name Comment"
            CASE &H895
                FUNCTION = "SORTDATA12: Sort Data 12"
            CASE &H896
                FUNCTION = "THEME: Theme"
            CASE &H897
                FUNCTION = "GUIDTYPELIB: VB Project Typelib GUID"
            CASE &H898
                FUNCTION = "FNGRP12: Function Group"
            CASE &H899
                FUNCTION = "NAMEFNGRP12: Extra Function Group"
            CASE &H89A
                FUNCTION = "MTRSETTINGS: Multi-Threaded Calculation Settings"
            CASE &H89B
                FUNCTION = "COMPRESSPICTURES: Automatic Picture Compression Mode"
            CASE &H89C
                FUNCTION = "HEADERFOOTER: Header Footer"
            CASE &H8A3
                FUNCTION = "FORCEFULLCALCULATION: Force Full Calculation Settings"
            CASE &H8c1
                FUNCTION = "LISTOBJ: List Object"
            CASE &H8c2
                FUNCTION = "LISTFIELD: List Field"
            CASE &H8c3
                FUNCTION = "LISTDV: List Data Validation"
            CASE &H8c4
                FUNCTION = "LISTCONDFMT: List Conditional Formatting"
            CASE &H8c5
                FUNCTION = "LISTCF: List Cell Formatting"
            CASE &H8c6
                FUNCTION = "FMQRY: Filemaker queries"
            CASE &H8c7
                FUNCTION = "FMSQRY: File maker queries"
            CASE &H8c8
                FUNCTION = "PLV: Page Layout View in Mac Excel 11"
            CASE &H8c9
                FUNCTION = "LNEXT: Extension information for borders in Mac Office 11"
            CASE &H8ca
                FUNCTION = "MKREXT: Extension information for markers in Mac Office 11"
            CASE &H8cb
                FUNCTION = "CRTCOOPT: Color options for Chart series in Mac Office 11"
           CASE ELSE
                FUNCTION = "Undefined " & HEX$(IdNumber)
        END SELECT
    END FUNCTION
    Attached Files
Working...
X