|
原代码如下
p = ThisWorkbook.Path & "\"
d = Format(Date, "yyyy年mm月dd日")
f = p & "新建 Microsoft Word 文档.aoc"
f2 = p & "2013" & s & ".doc"
FileCopy f, f2
现在想在最后一句前加一个判断当前文件是否存在,路径和文件名是变量f2,用变量如何写呀?
判断文件夹是否存在
Sub FileExist_Dir()
Dim strFile As String
strFile = ThisWorkbook.Path & "\test.xls"
If Dir(strFile) = "" Then
MsgBox strFile & " does not Exists"
Else
MsgBox strFile & " Exist"
End If
End Sub
|
|