Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error handling in shellfolder

Status
Not open for further replies.

ajtsystems

IS-IT--Management
Jan 15, 2009
80
GB
Hi, My error handling doesn't seem to be working:

sub backup (arrmem, backupdir)

err.clear
on error resume next
set objShell = CreateObject("shell.application")
set Shellfolder = objShell.NameSpace(backupdir)
shellfolder.CopyHere (arrmem), 272

if Err.number = 0 then
'happy days
else
' An exception occurred
strErrEvent = Request.ServerVariables("PATH_INFO") & vbTab & _
Err.Number & vbTab & Err.Description
WriteLog errorlogpath, strErrEvent, now
err.clear
End If

Even when I pull the network cable from the server where the files are being copied it doesn't log. I found this site where it shows a for each statement, iff error = 0 do something.

I cannot seem to get mine to work and wonder if i need a for each statement but as I am only copying 1 folder I cannot do it.

Anyhelp would be good
 
Code:
    strErrEvent = Request.ServerVariables("PATH_INFO") & vbTab & _
                Err.Number & vbTab & Err.Description
    WriteLog errorlogpath, strErrEvent, now

If you pull the network cable, I doubt Request.ServerVariables(... is going to work. Also, I don't see where you assign any value to errorlogpath.

Is the Request object created in code not shown? Also, is WriteLog another subroutine in your code?

 
On Error Resume Next" suppresses all runtime errors, until you undo this with "On Error Goto 0". If you trapped an error, try using "On Error Goto 0" to see if maybe your error routine has an error.
Code:
if Err.number = 0 then  
   'happy days
else
   [COLOR=blue]On Error Goto 0 [/color][COLOR=green]'allow runtime errors to show[/color]
   ' An exception occurred
    strErrEvent = Request.ServerVariables("PATH_INFO") & vbTab & _
                Err.Number & vbTab & Err.Description
    WriteLog errorlogpath, strErrEvent, now
   err.clear
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top