ray88’s diary

お仕事で困ったとき用の自分用の覚書

VBS 部品 パスの有無を確認

Function fncPathExists(strType,strPath)
'-----------------------------------------
'機能:パスの有無を確認する
'引数1:確認対象パスのタイプ(foledr または file で指定する)
'引数2:確認対象のパス
'戻り値:True または False
'-----------------------------------------
    dim FSO
    set FSO = CreateObject("Scripting.FileSystemObject")
    if strType = "folder" then
        fncPathExists = FSO.FolderExists(strPath)
    ElseIf strType = "file" then
        fncPathExists = fso.FileExists(strPath)
    Else
        fncPathExists = False
    end If
End Function