Hi All,
I'm having trouble trying to omit some user folder off of a script we use to distribute file to all staff.
The below script is used to distribute a single database to multiple folders which users here store their files and such.
I need to omit some users from receiving this new file as their systems haven't been upgraded.
So far I have only added:
But it doesn't like it, Any help would be greatly appriciated.Code:If InStr(f1.Name, "Dobbs, Terry" & "Seacole, Steve" & "Patel, Ash" & "Jenkins, Tricia") = ture Then Resume Next End If
Code:Dim fso, f, fc, f1, SourceFile Set fso = CreateObject("Scripting.FileSystemObject") Set SourceFile = fso.GetFile("H:\K Drive\Databases\NewLiveActs.mde") Set f = fso.GetFolder("H:\K Drive\") Set fc = f.SubFolders For Each f1 In fc If InStr(f1.Name, ",") > 0 Then On Error Resume Next SourceFile.Copy f1 & "\Databases\" If Err.Number <> 0 Then Select Case Err.Number ' Evaluate error number. Case 70 mystr = mystr & f1 & " - Permission Denied" & vbNewLine 'add to string here Case 76 mystr = mystr & f1 & " - Path not found" & vbNewLine ' add to string here Err.Clear Case Else End Select Else End If On Error GoTo 0 End If If InStr(f1.Name, "Dobbs, Terry" & "Seacole, Steve" & "Patel, Ash" & "Jenkins, Tricia") = ture Then Resume Next End If Next mystr = mystr & " -- File Distribution Completed -- " & vbNewLine Set f1 = fso.CreateTextFile("H:\K Drive\NewLiveactsScriptLog.txt", True) f1.Write mystr f1.Close Set f1 = Nothing Set fso = Nothing




Reply With Quote