Home All Groups Group Topic Archive Search About

Opening Password Protected Word Document in OLE

Author
26 Jun 2006 6:25 AM
Imtiaz Qamar
How can a password be provided to any password protected document while
opening in an OLE object?

Author
26 Jun 2006 5:58 PM
Paul Clement
On Sun, 25 Jun 2006 23:25:02 -0700, Imtiaz Qamar <ImtiazQa***@discussions.microsoft.com> wrote:

¤ How can a password be provided to any password protected document while
¤ opening in an OLE object?

There is a password property in the Open method of the Documents collection:

        Dim objWord As Word.Application
        Dim objDocument As Word._Document

        objWord = CreateObject("Word.Application")
        objDocument = objWord.Documents.Open(FileName:="C:\Test Files\Test1.doc",
PasswordDocument:="password")
        '...
        '...
        objDocument.Close()
        objDocument = Nothing
        objWord.Quit()
        objWord = Nothing


Paul
~~~~
Microsoft MVP (Visual Basic)