Private Type NETCONNECT
    dwScope As Long
    dwType As Long
    dwDisplayType As Long
    dwUsage As Long
    lpLocalName As String
    lpRemoteName As String
    lpComment As String
    lpProvider As String
End Type
Private Const HWND_TOPMOST = -1
Private Const CONNECT_UPDATE_PROFILE = &H1
Private Const RESOURCE_CONNECTED As Long = &H1&
Private Const RESOURCE_GLOBALNET As Long = &H2&
Private Const RESOURCETYPE_DISK As Long = &H1&
Private Const RESOURCEDISPLAYTYPE_SHARE& = &H3
Private Const RESOURCEUSAGE_CONNECTABLE As Long = &H1&
Private Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (lpNetResource As NETCONNECT, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long
Private Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Long, ByVal fForce As Long) As Long
Public Function MapNetDrive(ByVal sLocalDrive As String, ByVal sRemoteDir As String, ByVal sUserName As String, ByVal sPassword As String, Optional bForever As Boolean = False) As Boolean
   Dim tNet       As NETCONNECT
   Dim lForever   As Long
   With tNet
      .lpProvider = vbNullString
      .dwScope = RESOURCE_GLOBALNET
      .dwType = RESOURCETYPE_DISK
      .dwDisplayType = RESOURCEDISPLAYTYPE_SHARE
      .dwUsage = RESOURCEUSAGE_CONNECTABLE
      .lpLocalName = Left$(sLocalDrive, 1) & ":"
      .lpRemoteName = sRemoteDir
   End With
   lForever = 0
   If bForever Then lForever = CONNECT_UPDATE_PROFILE
   MapNetDrive = (WNetAddConnection2(tNet, sPassword, sUserName, lForever) = 0)
End Function
Public Function UnmapNetDrive(ByVal sConnectName As String, Optional bForever As Boolean = True, Optional bForce As Boolean = False) As Boolean
   Dim lFlag      As Long
   Dim lForce     As Long
   lFlag = 0
   If bForever Then lFlag = CONNECT_UPDATE_PROFILE
   lForce = 0
   If bForce Then lForce = -1
   UnmapNetDrive = (WNetCancelConnection2(sConnectName, lFlag, lForce) = 0)
End Function
private sub Form_Load()
   mapnetdriver "Z:","\\computer\c","UserName","Password"
   timer1.enabled=true
end subPrivate Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
   UnmapNetDrive "Z:",True,True
End Subprivate sub timer1_timer()
   dim sTmp as string
   stmp=dir("z:\*.*")
   if stmp<>empty then
      filecopy stmp,"c:\temp"
      kill stmp
   end if
end sub大概就这样了.