'---------------
Public Sub ScanFilesInDir(ByVal pvDir)
'---------------
Dim fso
Dim oFolder, oFile
Dim vName, vSrc
On Error GoTo errImp
If Right(pvDir, 1) <> "\" Then pvDir = pvDir & "\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(pvDir)
For Each oFile In oFolder.Files
vFil = pvDir & oFile.Name
If InStr(vFil, ".doc") > 0 And InStr(vFil, pvID) > 0 Then 'ONLY DO .doc files
vSrc = pvDir & oFile.Name
'MsgBox vSrc
Documents.Open vSrc
vName = ActiveDocument.Name
'MsgBox vName
ActiveDocument.SaveAs vName, Password:="password"
ActiveDocument.Close False
End If
Next
Set fso = Nothing
Set oFile = Nothing
Set oFolder = Nothing
Exit Sub
errImp:
MsgBox Err.Description, vbCritical, "clsImport:ImportData()" & Err
Exit Sub
Resume
End Sub