encrypting a block of files in Word 2002 SP3

L

Larry Root

I need to encrypt all of my Word files before I will be permitted to archive
them off my desktop computer. Is there a way to encrypt blocks of files at
one time or must I open and resave each one?

Thank you for any suggestions that you can offer.

Very respectfully,
Larry
 
G

Graham Mayor

You would have to open them individually and save the result. You could do
this with a batch processing macro, if you put the files into a folder for
that purpose first. The following macro should do that. Try it out with a
few files first to ensure that you can re-open them using the password.
ALWAYS work with copies and DO NOT delete the originals until you are sure
that you can open the password protected files.
DON'T FORGET THE PASSWORD!!!!!

Public Sub PasswordAll()
Dim strFileName As String
Dim sPassword As String
Dim bPassword As String
Dim strPath As String
Dim oDoc As Document
Dim bBack As Boolean
Dim Response As Long
Dim fDialog As FileDialog

Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "Add Password"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "\" Then strPath = strPath + "\"
End With
OpenPass:
sPassword = InputBox("Enter Password", "Password to Open")
bPassword = InputBox("Re-enter Password", "Password to Open")
If sPassword <> bPassword Then
MsgBox "The password and check do not match", _
vbCritical, "Password Error!"
GoTo OpenPass
End If
On Error Resume Next
Documents.Close SaveChanges:=wdPromptToSaveChanges
bBack = Options.CreateBackup
Options.CreateBackup = False
strFileName = Dir$(strPath & "*.doc")
While strFileName <> ""
Set oDoc = Documents.Open(strPath & strFileName)
With oDoc
.Password = sPassword
.SaveAs .FullName, AddtoRecentFiles:=False
.Close SaveChanges:=wdDoNotSaveChanges
End With
strFileName = Dir$()
Wend
Options.CreateBackup = bBack
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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