[英]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.