Open a password protected word file with the password

  • Hi all,


    I have a number of password protected Word templates that I need to open from within Excel using VBA.


    I use the following code to open the files but can not figure out how to send a password across?


    Any help would be appreciated.



    AJW



    Edit: WillR - added code tags... please use them when posting code. Thanks

  • Re: Open a password protected word file with the password


    From reading the Help, (I'm no word expert) it seems you can open a password protected document using the open method & supplying the password as part of the open procedure.



    I used the following code successfully


    Code
    Sub OpenDoc()
        Documents.Open FileName:="C:\Will\Willy willy.dot", PasswordTemplate:="password"
    End Sub
  • Re: Open a password protected word file with the password


    WillR


    Thanks for the reply, my email notification needs to be updated.


    I tried your solution but came up with an error regarding the object.


    Did the following to resolve:


    Word.Application.Documents.Open ("C:\ TEMPLATES\CONTRACT VARIATION .dot"), passwordtemplate:="checkopen", Visible:=True


    Thanks for the pointers, greatly appreciated.


    AJW

  • Re: Open a password protected word file with the password



    i wonder if i could ask the question on how this could be changed to open a passworded xl file so that info can be retrieved from the last cell in colum "A" and the resultant (from another file) row of figures returned to the file which is then updated closed and re-passworded.
    any help you can give would help resolve a problem i have inherited

  • Re: Open a password protected word file with the password


    Hi,


    If u really want to open your password protected word file then install (URL removed - advertising) software in your computer it will help u to open password protected file.
    It help me a lot i hope it also beneficial for u.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!