Just when I thought I was smarter than the 'puter.
Is there any possible way to Unprotect 50 docs at one
time in Word 2000? The Pword is universal among them but I don't
want to open each individually every time they change
(twice daily or better). I had seen someone suggest creating a macro to:
Open all docs in a folder>unprotect>save>close.
Sounds cool...I have no clue how to do that.
Anyone have an idea?
Thanks.
Chris Kearney
Tech Writer
A modification of this may work:
Sub ProcessBatchOfFiles()
Dim strBatchDir As String
Dim strFileExt As String
Dim i As Long
Dim oDoc As Word.Document
If MsgBox("This macro concatenates all DOC files in the directory you
select next.", vbOKCancel) = vbCancel Then
Exit Sub
End If
strFileExt = "doc"
'Call function to pick a batch directory for processing
strBatchDir = PickFolder
If strBatchDir = vbNullString Then Exit Sub
If strBatchDir <> "" Then
With Application.FileSearch
.NewSearch
.LookIn = strBatchDir
.SearchSubFolders = False
.FileName = "*." & strFileExt
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Set oDoc = Documents.Open(FileName:=.FoundFiles(i))
oDoc.Unprotect
oDoc.Close wdSaveChanges
'oDoc.Save Prompt:=wdDoNotSaveChanges
Set oDoc = Nothing
Next i
Else
MsgBox "There were no files found to concatenate."
End If
End With
Else
Exit Sub
End If
MsgBox "Concatenated " & i - 1 & " files."
End Sub
Function PickFolder() As String
'Open "Copy" so user can point and click to a path to use
Dim strFolderPath As String
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
strFolderPath = .Directory
Else
PickFolder = vbNullString
MsgBox "Cancelled by User"
Exit Function
End If
End With
If Left(strFolderPath, 1) = Chr(34) Then
strFolderPath = Mid(strFolderPath, 2, Len(strFolderPath) - 2)
End If
If Right(strFolderPath, 1) = "\" Then
strFolderPath = Mid(strFolderPath, 1, Len(strFolderPath) - 1)
End If
PickFolder = strFolderPath
End Function