VBA - 路径,GetSaveAsFileName给出URL/SaveCopyAs与UNC配合使用
问题描述:
- GetSaveAsFileName给出URL path;
- SaveCopyAs将得到一个UNC路径;
- 该文件未保存;
- 该过程没有给出警告;
- SharePoint访问不是映射的驱动器; 它已被安装为库。
- 我无法使用常量路径,因为用户可以选择其他Sharepoint映射。
这是我的代码:VBA - 路径,GetSaveAsFileName给出URL/SaveCopyAs与UNC配合使用
'Test: Is the file exists?
Dim CW_ExportFilePathAndName As String
CW_ExportFilePathAndName = FilePathForSave & CW_NameSaveFile
If Dir(CW_ExportFilePathAndName) <> "" Then
Dim InitialName As String
Dim sFileSaveName As Variant
InitialName = CW_ExportFilePathAndName
sFileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitialName, fileFilter:="Excel Files (*.xlsm), *.xlsm")
If sFileSaveName <> False Then
ActiveWorkbook.SaveCopyAs sFileSaveName
MsgBox "The source file is saved on an individual name!"
Else
MsgBox "The source file is not saved!"
End If
Else
ActiveWorkbook.SaveCopyAs CW_ExportFilePathAndName
End If
答
解决方法:另存为可与URL工作。只有重新开放必须解决!
你能告诉我们你正在使用什么代码吗?当我们不能明确你在做什么,以及出了什么问题时,很难提供帮助。另外,你如何检索这些提示?你提示用户吗? –
'CW_ExportFilePathAndName = FilePathForSave&CW_NameSaveFile'这是什么给你的URL,但你的代码并没有显示如何创建'FilePathForSave'和'CW_NameSaveFile' –
嗨,我已经附上了我的代码!我用msgbox测试了路径。我的路径:“\\ [email protected] \ RaWrote \ sites \ DKO \ aaa.xls”返回值:“https:/ecs.tel.de/sites/DKO/aaa1.xls./”如果我很好理解你的第二个问题:不,我不是。我有关于它的信息。谢谢!再见,Z – ZolGal