B
BillCPA
I am sorry to admit that I have done very little with error checking in my
macros, so I need some help in structuring here.
Our network drives need cleaning up really badly, and I have created a macro
that reads through the directory and creates a worksheet of all folders,
subfolders, subsubfolders, etc. I use nested For Each...Next loops to pull
out the data.
I have access to most everything on the network, but a couple of the big
dogs have their folders secured, and when I hit one of those, I get an access
denied error when I attempt to go into the folder to pull file and subfolder
names. The error occurs on the 'For Each' statement. In front of the 'For
Each' statement I put an 'On Error Resume Next' statement, but the statement
for 'resuming next' is the 'Next' for the 'For Each', and when it tries to
resume there, it says 'For loop not initialized', which of course is logical
since it never got into the loop.
Could I get some quick idea on how to branch somewhere, check the error
number, reset the error checking, and return to the statement after the
'Next' statement on that error? I would certainly appreciate it.
macros, so I need some help in structuring here.
Our network drives need cleaning up really badly, and I have created a macro
that reads through the directory and creates a worksheet of all folders,
subfolders, subsubfolders, etc. I use nested For Each...Next loops to pull
out the data.
I have access to most everything on the network, but a couple of the big
dogs have their folders secured, and when I hit one of those, I get an access
denied error when I attempt to go into the folder to pull file and subfolder
names. The error occurs on the 'For Each' statement. In front of the 'For
Each' statement I put an 'On Error Resume Next' statement, but the statement
for 'resuming next' is the 'Next' for the 'For Each', and when it tries to
resume there, it says 'For loop not initialized', which of course is logical
since it never got into the loop.
Could I get some quick idea on how to branch somewhere, check the error
number, reset the error checking, and return to the statement after the
'Next' statement on that error? I would certainly appreciate it.