判断网络路径是否存在 Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long Function NetPathExist(NetPath As String) As Boolean Dim Resu As Long Resu = WNetAddConnection(NetPath, vbNullString, "") If Resu = 0 Then NetPathExist = True Else NetPathExist = False End If End Function 访问网络路径上文件 Function OpenFile(NetPath As String) Dim fs As New FileSystemObject fs.GetFile(NetPath) End Function
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Function NetPathExist(NetPath As String) As Boolean
Dim Resu As Long
Resu = WNetAddConnection(NetPath, vbNullString, "")
If Resu = 0 Then
NetPathExist = True
Else
NetPathExist = False
End If
End Function
访问网络路径上文件
Function OpenFile(NetPath As String)
Dim fs As New FileSystemObject
fs.GetFile(NetPath)
End Function