detect if excel is protected

baisieux
03-27-2003, 10:04 AM
Hy,

from VB6, I'd like to find particular Excel files from a list. Some of them are password protected and I'd like to ignore them. Is there a way to detect if an Excel file is protected ?

Thank's,

Christophe

jbo
04-05-2003, 01:16 PM
Suppose a file "file.xls".
Try the following code which always fired an error:

workbooks.Open "file.xls", password:=""

Then test Err.Number to know the problem:
If the file has no password protection, Err.Number=403 .
Othercase, Err.Number=1004

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum