我正在尝试将文件上传到共享点站点,由于某种原因,发生了一些奇怪的事情,其中第一个文件从未上传,但随后会随机上传一些文件,有时会出现“获取列表”错误显示可用的内容类型和属性。
我需要帮助的2件事,首先是如何制作它,这样才能上传第一个文件,然后为什么有时会出现内容错误
这是我正在使用的代码
If Dir("\\server\content\90002613\Documents\TestGB\" & saveFileName, vbDirectory) = "" Then
MkDir ("\\server\content\90002613\Documents\TestGB\" & saveFileName)
End If
If Dir("\\server\content\90002613\Documents\TestGB\" & saveFileName & "\" & Format(lDate, "yyyy"), vbDirectory) = "" Then
MkDir ("\\server\content\90002613\Documents\TestGB\" & saveFileName & "\" & Format(lDate, "yyyy"))
End If
If Dir("\\server\content\90002613\Documents\TestGB\" & saveFileName & "\" & Format(lDate, "yyyy"), vbDirectory) <> "" Then
With ActiveWorkbook
Application.ActiveWorkbook.SaveAs Filename:="https://server/content/90002613/Documents/TestGB/" & saveFileName & "/" & Format(lDate, "yyyy") & "\GB RSM P" & Format(lDate, "mm") & "FY" & Format(lDate, "yyyy") & " " & saveFileName & ".xlsx"
Application.ActiveWorkbook.Close False
End With
End If
谢谢
答案 0 :(得分:0)
您应该能够保存到UNC路径:
Const BASE_DIR As String = "\\server\content\90002613\Documents\TestGB\"
Dim dt
If Dir(BASE_DIR & saveFileName, vbDirectory) = "" Then
MkDir (BASE_DIR & saveFileName)
End If
dt = Format(lDate, "yyyy")
If Dir(BASE_DIR & saveFileName & "\" & dt, vbDirectory) = "" Then
MkDir (BASE_DIR & saveFileName & "\" & dt)
End If
With ActiveWorkbook
.SaveAs Filename:="BASE_DIR " & saveFileName & "\" & dt & _
"\GB RSM P" & Format(lDate, "mm") & "FY" & _
Format(lDate, "yyyy") & " " & saveFileName & ".xlsx"
.Close False
End With