Share via

VBA dir error 52

San Soe 1 Reputation point
2022-01-25T01:36:02.177+00:00

I dir to remote computer in the network, I expected that some of the IP might not be able to access "error 52"

I just need to by pass if I can't connect to that remote computer and continue.

code is

Do until cells(x,1)=""
if dir(cells(x,1) aka IP_not_exit)<>""then
     do something
end if
x=x+1
loop
Developer technologies | Visual Basic for Applications
0 comments No comments

1 answer

Sort by: Most helpful
  1. Viorel 127K Reputation points
    2022-01-25T09:22:39.18+00:00

    Try something like this:

    Do Until Cells(x, 1) = ""
        Dim result As String
        On Error GoTo err1
        result = Dir(Cells(x, 1))
        On Error GoTo 0
        If result <> "" Then
            ' do something '
        End If
    err1:
        x = x + 1
    Loop
    

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.