经过一些搜索,我找不到解决我问题的方法。我每个月都有多个使用变量名保存到共享点站点的文件。我使用正确的变量名保存了文件。我使用“文件名” dim作为保存路径,所以我知道这是可行的。
我要做的是让vba检查共享点站点上是否已经存在该名称,以防止用户覆盖现有文件。下面是我在网上浏览时收集的代码。使用F8逐行运行vba代码,出现错误:
文件名或数字错误
有什么想法可以使其正常运行吗?
sub test()
Dim filename As String ''''filename is the sharepoint site and file name
DirFile = filename
If Len(Dir(filename)) = 0 Then
Else
MsgBox "File already exists on sharepoint site"
Exit Sub
End If
End Sub