Hi everyone. I have a button that runs 50 different processes but any one of them could occur an error, for example if a file path has changed.
I need the program to run these commands but tell the user which ones have failed. I have tried the code below but it cuts off after the 1st command regardless of if the next check box is checked
Can Anyone help?Code:On Error GoTo ErrorHandler1 If CheckBox1.Checked = True Then My.Computer.FileSystem.CopyDirectory( _ "C:\Transfer\", _ "\\192.168.1.50\c$\Transfer\", overwrite:=True) Exit Sub ErrorHandler1: MsgBox("An error occured @Transfer Scarborough - error " & Err.Number & ": " & Err.Description & "If Problem persistes, contact the programmer") On Error GoTo ErrorHandler2 If CheckBox2.Checked = True Then My.Computer.FileSystem.CopyDirectory( _ "C:\Transfer\", _ "\\192.168.2.50\c$\Transfer\", overwrite:=True) Exit Sub ErrorHandler2: MsgBox("An error occured @Transfer York - error " & Err.Number & ": " & Err.Description & "If Problem persistes, contact the programmer") On Error GoTo ErrorHandler3 If CheckBox3.Checked = True Then My.Computer.FileSystem.CopyDirectory( _ "C:\Transfer\", _ "\\192.168.3.50\c$\Transfer\", overwrite:=True) Exit Sub ErrorHandler3: MsgBox("An error occured @Transfer Hessle - error " & Err.Number & ": " & Err.Description & "If Problem persistes, contact the programmer")
This is replicated 52 times, I.e 52 file copies and 52 error handlers that all need to be dealt with from this one button.
Also, is it possible for the error message to pop up at the end telling the user which have failed rather than after each transfer attempt as some files we need to send are around 100mbs over a WAN so may need to be left to run over night




Reply With Quote
