Dir() function
-
Is there a reason Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory) THe only difference beig one is a network drive, the other is not?
No-e wrote:
Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory)
Try
Dim mypath mypath = "\\RemoteHostName\ShareName" myname = Dir(MyPath, vbDirectory)
Tell me whether it is working or not. -
Is there a reason Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory) THe only difference beig one is a network drive, the other is not?
Well without knowing the error you are receiving I'm guessing but perhaps the V: drive does not exist or you do not have sufficient authority to access that network resource?
...Steve
1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-) -
No-e wrote:
Dim mypath mypath = "V:\" myname = Dir(MyPath, vbDirectory) will not work, but Dim mypath mypath = "C:\" myname = Dir(MyPath, vbDirectory)
Try
Dim mypath mypath = "\\RemoteHostName\ShareName" myname = Dir(MyPath, vbDirectory)
Tell me whether it is working or not. -
This does not work either. I do not get an error, I just do not get anything for either case (using path or drive letter) Any other ideas?
-
Well without knowing the error you are receiving I'm guessing but perhaps the V: drive does not exist or you do not have sufficient authority to access that network resource?
...Steve
1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)Steve Pullan wrote:
Well without knowing the error you are receiving I'm guessing but perhaps the V: drive does not exist or you do not have sufficient authority to access that network resource?
In my opinion, his computer is try to check for the remote host availability which usually know as name resolution. If this happend, i think he might waiting during the name resolution process in the stage of broadcast the signal for the remote host and waiting for an answer. If he do not have permission to access the resource, the message box should indicate him that access is denied.
-
Try this code:
Dim mypath mypath = "\\[IPAddressOfRemoteHost]\ShareName" myname = Dir(MyPath, vbDirectory)
Example:Dim mypath mypath = "\\192.168.1.1\Report" myname = Dir(MyPath, vbDirectory)
Thanks, but that is actually the way I tested it. mypath = "\\10.22.222.150\datadrive\logs" ' Set the path. myname = Dir(mypath, vbDirectory) ' Retrieve the first entry. Odd thing is that I do not get any error at all, just no answer.... I have tried several different computers, can not get anything across the network....
-
Thanks, but that is actually the way I tested it. mypath = "\\10.22.222.150\datadrive\logs" ' Set the path. myname = Dir(mypath, vbDirectory) ' Retrieve the first entry. Odd thing is that I do not get any error at all, just no answer.... I have tried several different computers, can not get anything across the network....