Open Word Document With Modify Password

J

JMB

Using VBA to open Word documents. I get a prompt if the document requires a
password to modify. I would like to use VBA code to open read only and search
the document without being prompted -- going through hunders of documents and
if certain info is found the file is logged. Current code:

Dim rstDoc As New ADODB.Recordset
Dim objWDApp As New Word.Application
Dim objDoc As Word.Document
rstDoc.Open "FileList", Application.CurrentProject.Connection,
adOpenKeyset
rstDoc.MoveFirst
On Error GoTo DocumentErrors
Do While Not rstDoc.EOF
Set objDoc = objWDApp.Documents.Open(strFile, True)

In this example, the ReadOnly parameter of the Open method is set to True. I
get the dialog prompt and I get it if I set the parameter to False. I've also
tried the "Skipping Password-Protected Documents in a Batch Process" from MS
Word MVP FAQ site and that doesn't work either.

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top