简体   繁体   English

Excel VBA:将文件保存在与宏相同的位置

[英]Excel VBA : Save file in the same location as macro

How do I save the result of the macro ie and excel file in the same folder where the macro file is located ? 如何将宏ie和excel文件的结果保存在宏文件所在的文件夹中?

I am trying to use the below code : 我正在尝试使用以下代码:

CurDir
ActiveWorkbook.SaveAs FileName:="Accenture.xlsx" FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

Try: 尝试:

ActiveWorkbook.SaveAs FileName:= ThisWorkbook.Path & "\Accenture.xlsx" ...

For further details, please see: 有关更多详细信息,请参见:
Workbook.Path Property Workbook.Path属性
How to: Get and Set the Default File Path for Workbooks 如何:获取和设置工作簿的默认文件路径

用这个:

ThisWorkbook.SaveAs ThisWorkbook.Path & Application.PathSeparator & "dummy.xlsm"

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

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