Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Password Protected Workbook with VBA

Status
Not open for further replies.

johnnymagee

Programmer
Apr 19, 2005
26
GB
Trying to open a workbook reserved with a password. I've never had problems with this before but for this particular book, the password dialog appears even though it is included in the code.

Dim oXL as excel.application
Dim owbk as workbook

set oXL = new excel.application

set owbk = oXL.workbooks.open("S:\BOOK.XLS",Readonly:=false,Password:="Stuff")

This is annoying because if I dont have the active workbook running this macro minimised, even the dialog doesn't appear and I get a warning that "Excel is waiting for an OLE application" and I have to cancel everything.
 
Are you sure the password is right?

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
there can be 2 passwords - one for open access, one for modify access - if it has both, this may be the cause...

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Doh! Forgot there was a WriteResPassword option as well.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top