• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to enter password by VBA.

ThrottleWorks

Excel Ninja
How to enter password by VBA.


Hi, I have a macro, this macro needs to open a particular file for extracting data.

This file is password protected, whenever I run the macro, before opening the file the macro gives a dialog box to enter the password.


This is a normal dialog box which we get while opening password protected file.

After entering the password, the macro accesses the file & complete the work.


MY doubt is can we enter the password by VBA only.


Can anyone help me in this please.


P.S. - The file is protected by using excel options, prepare, encrypt document.

P.S.S. - I know the password, I am not trying to hack the file 
 
Hi Sachin,


sub sk

workbooks.open FileName:="C:Old Tanglewood Numbers.xls", Password:="123"

end sub


Thanks,

Suresh Kumar s
 
Back
Top