阅读背景:

【自定义函数】判断指定文件夹下是否包含子文件夹

来源:互联网 
Function CheckFolder(sPath As String) As Boolean        '参数为指定文件夹的路径,返回值为 Boolean 型
    If Right(sPath, 1) <> "/" Then sPath = sPath & "/"       '判断路径右端是否包含"/",如果不包含则添加
    Dim sDir As String
    sDir = Dir(sPath & "*.*", vbDirectory)
    While sDir <> ""
      If GetAttr(sPath & sDir) And vbDirectory Then
         CheckFolder = True
         sDir = ""
      Else
         sDir = Dir()
      End If
    Wend
  End FunctionFunction CheckFolder(sPath As String) As Boolea



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: