Hi.
If I know the password of a MSWORD document that has open password, can I open it thru VB code or not?
Anybody know?
Thanks
Wengang
Printable View
Hi.
If I know the password of a MSWORD document that has open password, can I open it thru VB code or not?
Anybody know?
Thanks
Wengang
Hi wengang !!!
Taken von Word 97 Help file
Syntax
documents.Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format)
PasswordDocument
Variant optional. Password to open the Document.
e.g.
documents.open Filename:="c:\mydoc.doc",PasswordDocument:="MyPassword"
-cu TheOnly
Hey TheOnly,
Thanks. but one question.. I have no idea what your code means or how to use it. Can you explain a bit more?
Hi wengang!!!
There is a little example below. (tested with vb6 and w2000)
If you need this in Word then reply to this tread.
-cu TheOnly
'set a references to MS word
'Menuitem Project--> references
'declare objWord as word
Dim objWord As Word.Application
'create a new instance of word
Set objWord = New Word.Application
'with Word
With objWord
'make Word Window visible
.Visible = True
'open the password proteced Document
.Documents.Open FileName:="c:\pwd.doc", PasswordDocument:="MyPassword"
End With
'place your code here what ever you want
'this will close all documents
'only for testing I want that nothing will be saved
'note you can also close only 1 Documente
objWord.Documents.Close savechanges:=False
'close Word
objWord.Quit
'set the reference to nothing
Set objWord = Nothing
you are the coolest! :)