Hi
I've registered here hoping someone can help me with error trapping, my code is below:
wsdocs = "\\" & Sheets(b).Range(currentname) & "\c$\docume~1\"
Set fold = fso.GetFolder(wsdocs)
For Each Folder In fold.SubFolders
If Folder.Name = "All Users" Then GoTo nextfolder
If Folder.Name = "RM Default User" Then GoTo nextfolder
If Folder.Name = "Default User" Then GoTo nextfolder
If Folder.Name = "LocalService" Then GoTo nextfolder
If Folder.Name = "NetworkService" Then GoTo nextfolder
If Folder.Name = "Administrator" Then GoTo nextfolder
UserForm2.ListBox1.AddItem Sheets(b).Range(currentname) & "\" & Folder.Name
Basically, the entire code looks up a list of computers from a spreadsheet, and then adds the user folders from documents and settings to a listbox, however this works fine if the machine(s) is turned on.
I need some kind of error trapping for if the machine is off - this doesn't seem to work. It just hangs, and then eventually comes up with error 76.
If it does manage to find a computer thats on, for example if the list is:
station1
station2
station3
and station 2 is turned off, but 1 and 3 are on, then it will add station1's folders fine, but then it will add the same folders but say they are on station2 also. It will then pick up the correct folders on station3 (as its on).
Please can I have some advice as to where to put the error handling?
Thanks!