From: Hakyab on
Is there a way to check whether a workbook requires a password to open, prior
to opening the workbook?

What I want to do is to capture the password as the user enters it so I can
use the password for subsequent workbooks.open statements. I thought that my
module will prompt for the password, but I am not sure how this will behave
if there is no password to begin with.

Any help is appreciated, thanks.
From: Jacob Skaria on
If you only have the open password; then supply passwords for all workbook
open statements and Excle will ignore if the workbook do not have a
password....

Dim strPassWord

strPassWord = InputBox("Enter password for your workbooks")
'workbook with password
Workbooks.Open "d:\temp.xls", Password:=strPassWord

'workbokk without password
Workbooks.Open "d:\temp1.xls", Password:=strPassWord


--
Jacob (MVP - Excel)


"Hakyab" wrote:

> Is there a way to check whether a workbook requires a password to open, prior
> to opening the workbook?
>
> What I want to do is to capture the password as the user enters it so I can
> use the password for subsequent workbooks.open statements. I thought that my
> module will prompt for the password, but I am not sure how this will behave
> if there is no password to begin with.
>
> Any help is appreciated, thanks.