我下载了需要根据单元格 A1 中包含的名称重命名的文件。该文件已经保存在当前目录中,所以我只需要保存到当前目录,文件名在调用 A1 中,扩展名为“.xls”
试过这段代码:
Sub SaveToRelativePath()
Dim relativePath As String, sname As String
sname = ActiveWorkbook.Worksheets(1).Range("A1") & ".xls"
relativePath = Application.ActiveWorkbook.Path & "\" & sname
ActiveWorkbook.SaveAs Filename:=relativePath
End Sub
但是调试器在最后一行报错:ActiveWorkbook.SaveAs Filename:=relativePath
关于如何做到这一点的任何线索?