[英]Copying the cell from One workbook to another workbook in excel using vba
[英]VBA macro to save excel file using path from cell in another workbook
我正在尝试将表格TDadosRecTransf从ModStatRec.xlsm复制到一个我想另存为TDadosRecTransf.xlsx的新文件中。 我希望保存文件TDadosRecTransf.xlsx的路径是ModStatRec.xlsm中表“ Instrucoes”的单元格A9中的文本值,以代替我现在拥有的“ C:\\ Transfer \\ Receitas \\”。
我有以下代码
Sheets("TDadosRecTransf").Select
Sheets("TDadosRecTransf").Copy
ActiveWorkbook.SaveAs Filename:="C:\Transfer\Receitas\TDadosRecTransf.txt", _
FileFormat:=xlText, CreateBackup:=False
我试图在这样的代码顶部设置一个变量
Dim Filepath As String
Filepath = Workbooks("ModStatRec.xlsm").Worksheets("Instrucoes").Range("A29").Value
和线
ActiveWorkbook.SaveAs Filename:="Filepath" & "\TDadosRecTransf.txt", FileFormat:=xlText, CreateBackup:=False
但这是行不通的。
我究竟做错了什么? 我该怎么做? 请帮忙...
删除双引号
ActiveWorkbook.SaveAs Filename:=Filepath & "\TDadosRecTransf.txt", FileFormat:=xlText, CreateBackup:=False
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.