|
-
Oct 27th, 2000, 04:14 AM
#1
Thread Starter
Frenzied Member
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
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
-
Oct 27th, 2000, 04:24 AM
#2
Addicted Member
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
-
Oct 27th, 2000, 04:31 AM
#3
Thread Starter
Frenzied Member
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?
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
-
Oct 27th, 2000, 06:12 AM
#4
Addicted Member
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
-
Oct 27th, 2000, 04:56 PM
#5
Thread Starter
Frenzied Member
you are the coolest! 
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|