简体   繁体   English

在 SharePoint 中保存启用宏的工作簿

[英]Save macro enabled workbook in SharePoint

I want to save an XL sheet in macro enabled workbook into a SharePoint folder.我想将启用宏的工作簿中的 XL 工作表保存到 SharePoint 文件夹中。

I have tried couple of things but it is giving me an error.我已经尝试了几件事,但它给了我一个错误。

    Path = "https://xxxx/sites/xxxxx/"
    FileName1 = Range("$B$2").Text
    ActiveWorkbook.SaveAs Filename:=Path & FileName1 & ".xlsx", _
                          FileFormat:=xlOpenXMLWorkbook
    Application.DisplayAlerts = True
    ActiveWorkbook.Close
End If

I tried using the FileFormat:=52 .我尝试使用FileFormat:=52 The file is only saving in ".xslx" format.该文件仅以“.xslx”格式保存。

The file format should be FileFormat:=xlOpenXMLWorkbookMacroEnabled (which is 52)文件格式应为FileFormat:=xlOpenXMLWorkbookMacroEnabled (即 52)

But your file extension is still set to .xlsx in your code, which should be .xlsm - The extension has to match the file format.但是您的代码中的文件扩展名仍设置为.xlsx ,应该是.xlsm - 扩展名必须与文件格式匹配。

List of File Formats for XlFileFormat enumeration XlFileFormat 枚举的文件格式列表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM