尝试编写一个函数来检测文件(pdf)是否存在。由于有许多文件/文件夹,我想从单元格值构建文件路径。
到目前为止我有这个:
Public Function FileExists(FullpathName As String) As Boolean
If Len(Dir(FullpathName)) = 0 Then
FileExists = True
Else
FileExists = False
End If
End Function
我在单元格中输入了这个:
=FileExists(A2&B2&A3&" "&A1&" "&C2&".pdf")
但是当文件肯定在那里时,它会将其返回为假。任何人都可以阐明我所缺少的东西吗?
谢谢!