View Single Post
  #3   Report Post  
Ant
 
Posts: n/a
Default

Do I assume this will work on USB Flash drives where all the documents are?


On 2/28/2005 12:28 AM PT, Graham Mayor wrote:

Only with a macro. The following will do the job on a folder full of files.
Put the path to that folder where indicated:
http://www.gmayor.com/installing_macro.htm

Public Sub PasswordAll()

Dim FirstLoop As Boolean
Dim myFile, Password, PathToUse As String
Dim myDoc As Document
Dim Response As Long

'*************************************
'Set the required path here
PathToUse = "C:\Path\"
'*************************************
sPassword = InputBox("Enter Password")

On Error Resume Next
Documents.Close Savechanges:=wdPromptToSaveChanges
FirstLoop = True
myFile = Dir$(PathToUse & "*.doc")
While myFile ""
Set myDoc = Documents.Open(PathToUse & myFile)
If FirstLoop Then
With ActiveDocument
.Password = sPassword
.WritePassword = sPassword
End With
FirstLoop = False

Response = MsgBox("Do you want to process " & _
"the rest of the files in this folder", vbYesNo)
If Response = vbNo Then Exit Sub
Else
With ActiveDocument
.Password = sPassword
.WritePassword = sPassword
End With
End If
myDoc.Close Savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub

--
"Caution is not cowardice; even the ants march armed." --Ugandan Proverb
/\___/\
/ /\ /\ \ Phillip (Ant) @ http://antfarm.ma.cx & http://aqfl.net
| |o o| | E-mail (nuke ANT if replying privately to a newsgroup
\ _ / post): NT or
( )
Ant is currently not listening to any songs on his home computer.