Results 1 to 5 of 5

Thread: [RESOLVED] IF Statements

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Posts
    106

    Resolved [RESOLVED] IF Statements

    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:

    Code:
    If InStr(f1.Name, "Dobbs, Terry" & "Seacole, Steve" & "Patel, Ash" & "Jenkins, Tricia") = ture Then
          Resume Next
    End If
    But it doesn't like it, Any help would be greatly appriciated.

    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
    Last edited by Kubull; Jan 13th, 2010 at 06:17 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width