I answered this to your similar question in the vba forum you posted to and
provided code. That reply is below:
The following should work. If you have already removed the password(s),
leave the password prompts blank
Sub BatchProcess()
Dim strFileName As String
Dim strPath As String
Dim sPassword1 As String
Dim sPassword2 As String
Dim oDoc As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
sPassword1 = InputBox("Enter Password to open Document")
sPassword2 = InputBox("Enter Password to edit Document")
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , _
"List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" _
Then strPath = strPath + "\"
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFileName = Dir$(strPath & "*.doc")
While Len(strFileName) <> 0
Set oDoc = Documents.Open(FileName:=strPath & strFileName, _
PasswordDocument:=sPassword1, _
WritePasswordDocument:=sPassword2)
'
'Do what you want with oDoc
With oDoc
.Password = ""
.WritePassword = ""
.ReadOnlyRecommended = False
.Close SaveChanges:=wdSaveChanges
End With
strFileName = Dir$()
Wend
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site
www.gmayor.com
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>