I'm trying to copy a sheet TDadosRecTransf from ModStatRec.xlsm to a new file that I want to save as TDadosRecTransf.xlsx. I want that the path to save the file TDadosRecTransf.xlsx be a text value in cell A9 of sheet "Instrucoes" in ModStatRec.xlsm in substitution of "C:\\Transfer\\Receitas\\"that I have now.
I have the following code
Sheets("TDadosRecTransf").Select
Sheets("TDadosRecTransf").Copy
ActiveWorkbook.SaveAs Filename:="C:\Transfer\Receitas\TDadosRecTransf.txt", _
FileFormat:=xlText, CreateBackup:=False
I tried to setup a Variable in the top of code like this
Dim Filepath As String
Filepath = Workbooks("ModStatRec.xlsm").Worksheets("Instrucoes").Range("A29").Value
and the line
ActiveWorkbook.SaveAs Filename:="Filepath" & "\TDadosRecTransf.txt", FileFormat:=xlText, CreateBackup:=False
But this doesn't work.
What am I doing wrong? How can I get this done? Please help...
删除双引号
ActiveWorkbook.SaveAs Filename:=Filepath & "\TDadosRecTransf.txt", FileFormat:=xlText, CreateBackup:=False
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.