'添加引用 Windows Script Host Object Model
Sub SearchShared()
Dim a As WshNetwork
Dim oPrinter As zqdylbr> Set a = New WshNetwork
Set oPrinter = a.EnumPrinterConnections
Debug.Print "Network printer mappings:"
For i = 0 To oPrinter.Count - 1 Step 2
Debug.Print "Port" & oPrinter.Item(i) & oPrinter.Item(i + 1)
Next
Dim colDrives As zqdylbr> Set colDrives = a.EnumNetworkDrives
If colDrives.Count = 0 Then
Else
MsgBox colDrives.Count
strmsg = "当前网络驱动器连接:" & crlf
For i = 0 To colDrives.Count - 1 Step 1
Debug.Print colDrives(i)
Next
End If
End bhdlf/p>