gpt4 book ai didi

vba - 运行时错误 1004

转载 作者:行者123 更新时间:2023-12-04 23:36:17 28 4
gpt4 key购买 nike

尝试运行以下内容时,出现以下错误:

"This extension can not be used with the selected file type. Change the file extension in the file name text box or select a different file type by changing the save as type."



代码:
Dim strPath As String
Dim strFolderPath As String


strFolderPath = "Y:\

strPath = strFolderPath & _
Sheet1.Range("A1").Value & _
Sheet1.Range("B1").Value & ".xlsx"


ActiveWorkbook.SaveAs Filename:=strPath

最佳答案

该错误意味着 ActiveWorkbook 正在尝试另存为不同的文件格式,然后是“.xlsx”。要强制它保存为 .xlsx,您还必须传递文件格式。

ActiveWorkbook.SaveAs Filename:=strPath, FileFormat:=xlOpenXMLWorkbook

关于vba - 运行时错误 1004,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6629573/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com