How to get value of a excel-fields without open the workbook.
Amedee Van Gasse wrote:
A workbook which requires a password to open cannot be read using
ADO.
<rant
Bleh. That really sucks. Why can't we just add the damn password to
the
connection string as with *normal* data sources. Someone at Redmont
was
probably thinking, "hey, let's see how we can annoy our users".
</rant
IIRC, unlike regular database security, adding a workbook password
encrypts the data on disk and ADO doesn't have the capability to
decrypt it.
FWIW a worksheet password does not encrypt. Here are the details in
full and, as this is about ADO, how about some DDL:
CREATE TABLE XLProtectionPermissions (
ExcelObject VARCHAR(5)
DEFAULT 'Sheet' NOT NULL,
HasPassword VARCHAR(1)
DEFAULT 'N' NOT NULL,
CanRead VARCHAR(1)
DEFAULT 'N' NOT NULL,
CanWrite VARCHAR(1)
DEFAULT 'N' NOT NULL,
PRIMARY KEY (ExcelObject, HasPassword),
CHECK (ExcelObject IN ('Sheet', 'Book')),
CHECK (HasPassword IN ('N', 'Y')),
CHECK (CanRead IN ('N', 'Y')),
CHECK (CanWrite IN ('N', 'Y'))
)
;
INSERT INTO XLProtectionPermissions
(ExcelObject, HasPassword, CanRead, CanWrite)
VALUES ('Sheet', 'N', 'Y', 'Y')
;
INSERT INTO XLProtectionPermissions
(ExcelObject, HasPassword, CanRead, CanWrite)
VALUES ('Sheet', 'Y', 'Y', 'N')
;
INSERT INTO XLProtectionPermissions
(ExcelObject, HasPassword, CanRead, CanWrite)
VALUES ('Book', 'N', 'Y', 'Y')
;
INSERT INTO XLProtectionPermissions
(ExcelObject, HasPassword, CanRead, CanWrite)
VALUES ('Book', 'Y', 'N', 'N')
;
SELECT
ExcelObject, HasPassword, CanRead, CanWrite
FROM XLProtectionPermissions
;
Jamie.
--
|