ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¸ê®Æ§¨´M§ä¤å¦rÀɮצWºÙ°ÝÃD´M°Ý

  1. Option Explicit
  2. #If VBA7 Then
  3.   Private Declare PtrSafe Function PathIsDirectoryW Lib "shlwapi.dll" (ByVal pszPath As LongPtr) As Long
  4.   Private Declare PtrSafe Function PathFileExistsW Lib "shlwapi.dll" (ByVal pszPath As LongPtr) As Long
  5. #Else
  6.   Private Declare Function PathIsDirectoryW Lib "shlwapi.dll" (ByVal pszPath As Long) As Long
  7.   Private Declare Function PathFileExistsW Lib "shlwapi.dll" (ByVal pszPath As Long) As Long
  8. #End If

  9. '检测¤å¥ó¬O§_¦s¦b
  10. Public Function FileExists(ByVal strPath As String) As Boolean
  11.   strPath = strPath & String(5, vbNullChar)
  12.   If PathFileExistsW(StrPtr(strPath)) Then
  13.     FileExists = PathIsDirectoryW(StrPtr(strPath)) = 0
  14.   End If
  15. End Function

  16. Public Sub FilesExists()
  17.   Dim I As Long
  18.   For I = 1 To Range("A" & Rows.Count).End(xlUp).Row
  19.     Range("B" & I).Value = FileExists("\\89.80.70.1\design\add_word\" & Range("A" & I).Value & ".TXT")
  20.   Next I
  21. End Sub
½Æ»s¥N½X
¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

        ÀR«ä¦Û¦b : §Ú­Ì³Ì¤jªº¼Ä¤H¤£¬O§O¤H¡D¥i¯à¬O¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD