Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to open a password protected excel file using VBScript?

1,380 views
Skip to first unread message

murali

unread,
Nov 15, 2006, 2:54:47 AM11/15/06
to
Hi,

How to open a password protected excel file using VBScript?

sPath = "c:\test\test.xls'
oExcel.Workbooks.Open sPath

this opens the excel file but asking for password. (the test.xls is
password protected). To open the excel I need to give the password
everytime. Is there a way to pass the password in code, so that the
clients will not get annoyed by the password request popup everytime?

thanks

murali

unread,
Nov 15, 2006, 2:54:51 AM11/15/06
to

ekkehard.horner

unread,
Nov 15, 2006, 3:18:17 AM11/15/06
to
according to the Docs, the prototype for the Open function is:

Ausdruck.Open( FileName,
UpdateLinks,
ReadOnly,
Format,
Password,
WriteResPassword,
IgnoreReadOnlyRecommended,
Origin,
Delimiter,
Editable,
Notify,
Converter,
AddToMRU
)

so

Set oWBook = oExcel.Workbooks.Open( sPath,,,,sPassW )

should work (not tested; check your Docs and my ","s carefully). But why
protect c:\test\test.xls if you do extra work to allow unlimited access
for everybody who can run or read your script?


0 new messages