[RESOLVED] VBA to VBScript
I've been trying to develop a File distribution script, with some success, I've managed to get the script to copy one file and then distribute it into the many folders, but now I'd like it to record the folders it has skipped due to errors IE: Error 76 "File path not found". But I can't get it to work, Any suggestions?
Code:
Workbooks.Add
Range("A1").Value = "Folders Omitted"
Range("A1").Font.Bold = True
ActiveCell.Offset(1, 0).Select
Dim fso, f, fc, f1, SourceFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set SourceFile = fso.GetFile("E:\Test Area\NormalUpdates\NormalPM\normal.dot")
Set f = fso.Getfolder("E:\Test Area\")
Set fc = f.SubFolders
For Each f1 In fc
If InStr(f1.Name, ",") > 0 Then
On Error Resume Next
SourceFile.Copy f1 & "\Databases\normal_PM\"
If Err.Number <> 0 Then
Select Case Err.Number ' Evaluate error number.
Case 76 ' "Path not found" error.
ActiveCell.Value = f1
ActiveCell.Offset(1, 0).Select
'LogInformation f1
Err.Clear
Case Else
ActiveCell.Value = f1
ActiveCell.Offset(1, 0).Select
End Select
Else
End If
On Error GoTo 0
End If
Next
Objexcel.ActiveWorkbook.SaveAs("E:\Test Area\Noticeboard\NormalUpdates\omitted files.xls")
ObjWorkbook.Close