VBA - path,GetSaveAsFileName使URL / SaveCopyAs与UNC一起使用

时间:2017-02-16 14:28:11

标签: vba url sharepoint path unc

  • GetSaveAsFileName提供网址路径;
  • SaveCopyAs可以获得 UNC 路径;
  • 文件未保存;
  • 该项目没有发出警告;
  • SharePoint访问不是映射驱动器; 它已作为库安装。
  • 我不能使用常量路径,因为用户可以选择其他共享点mappe。

这是我的代码:

  '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    

1 个答案:

答案 0 :(得分:0)

解决方法:SaveAs可以使用URL。只有重新开放才能解决!