我编写了以下过程将文件保存到网络路径:
Sub Save_Book()
Dim savePATH As String
savePATH = "\\ftl-store\Departments\HR\HR Reports and Metrics\LOA Reports\BRT Reports"
Application.ScreenUpdating = True
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=savePATH & sFile, FileFormat:=51
Application.DisplayAlerts = False
End Sub
但是,我的程序无法正常运行。其将文件保存到路径,但路径正确。它将文件保存到此处:\\ftl-store\Departments\HR\HR Reports and Metrics\LOA Reports\BRT Reports"
因此丢失了目标文件夹。
代替将文件保存到路径,它需要执行以下操作:
BRT Reports
,并在保存时显示为我的文件名的一部分。
任何帮助将不胜感激。
答案 0 :(得分:1)
您必须添加结尾的反斜杠:
Sub Save_Book()
Dim savePATH As String
savePATH = "\\ftl-store\Departments\HR\HR Reports and Metrics\LOA Reports\BRT Reports\"
Application.ScreenUpdating = True
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=savePATH & sFile, FileFormat:=51
Application.DisplayAlerts = False
End Sub