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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to know if the XLS or DOC files is password protected?

Status
Not open for further replies.

dennis22

Programmer
Oct 8, 2002
32
Hi to all!

Is it possible to determine if an XLS or DOC file is password protected. I have this routine that prints all attachments. I encountered an XLS file that is password protected and end up with errors when opening it.

Thanks!
:)
 
Thanks for your reply Mr. Mike!

I have seen the property HasPassword and excel has it too, however the document or workbook should already be open before I could perform the HasPassword property. Is it possible to know if the xls or doc file has a password or not before openning it. Something like;

if DoesXlsHasPassword("C:\TEST.XLS")
--- ignore it and ask the password later
else
--- open it and start printing
endif

Is there any workarounds or any ideas you can share on how to deal with it. My apologies for asking a stupid question.

Thanks again! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top