How password protection of Excel VBA code works?

后端 未结 3 1280
心在旅途
心在旅途 2020-12-11 04:04

This question is related to my previous one.

Can you explain or provide a link to an explanation of how Excel VBA code password protection actually works in versions

3条回答
  •  独厮守ぢ
    2020-12-11 04:52

    Phil is correct - the password prevent you from looking at the modules, they are not encrypted themselves. I know in excel 2007 a file is essentially a zipped collection of XML and other files, but I don't know the details of how encryption is handled. For earlier versions - excel 2, 3, 4, 5, 95, 97, 2000, XP, & 2003, there is the comprehensive OpenOffice.org's Documentation of the Microsoft Excel File Format:

    The Excel file format is named BIFF (Binary Interchange File Format). It is used to store all types of documents: worksheet documents, workbook documents, and workspace documents. There are different versions of this file format, depending on the version of Excel that has written the file, and depending on the document type.

    A workbook document with several sheets (BIFF5-BIFF8) is usually stored using the compound document file format (also known as “OLE2 storage file format” or “Microsoft Office compatible storage file format”). It contains several streams for different types of data. A complete documentation of the format of compound document files can be found here.

    The Workbook Protection Block occurs just after the DEFINEDNAME block (i.e. Named Ranges) in most BIFF streams, although BIFF8 is a major departure from that pattern. The record protection block In Biff5 - Biff8 the structure of the Workbook Protection Block:

    • WINDOWPROTECT Window settings: 1 = protected
    • PROTECT Workbook contents: 1 = protected
    • PASSWORD Hash value of the password; 0 = no password
    • PROT4REV Shared workbook: 1 = protected
    • PROT4REVPASS Hash value of the shared password; 0 = no password

    The password block stores a 16-bit hash value, calculated from the worksheet or workbook protection password.

提交回复
热议问题