Dayene Dias
Programmer
Hello!
I created a macro with VBA on EXCEL to export a table to a TXT file. But, I did a "for" function that returns all lines of my table to a TXT file; and in the end of that file, the function "Print" adds a plus line. I need to exclude this line, because when I use this file, it doesn´t work. My code is:
I need find some function to overrite the "Print", that doesn´t add a line in the end of the file.
I am sorry about my English and thank you!
I created a macro with VBA on EXCEL to export a table to a TXT file. But, I did a "for" function that returns all lines of my table to a TXT file; and in the end of that file, the function "Print" adds a plus line. I need to exclude this line, because when I use this file, it doesn´t work. My code is:
Sub Exportar_TXT()
'REPLICAR A FORMULA CONCATENADORA PARA TODAS AS LINHAS DA TABELA
'CONTAR QUANTAS LINHAS NA TABELA DE CLIENTES
linhas = Sheets("CLIENTES").Range("A9").CurrentRegion.Rows.Count - 1
Sheets("txt").Range("A10:iv64000").Clear
Sheets("txt").Range("A9:A" & 9 + linhas).FillDown
'EXPORTAR A PLANILHA TXT
NOME_ARQUIVO = ThisWorkbook.Path & "\" & Sheets("CLIENTES").Range("CONVENIO").Value & "_" & Sheets("CLIENTES").Range("NOME_MES").Value & "_" & Sheets("CLIENTES").Range("ANO_REF").Value & ".TXT"
Open NOME_ARQUIVO For Output As 1
For LINHA = 9 To 9 + linhas
[highlight #CC0000] Print #1, Sheets("TXT").Cells(LINHA, 1).Value[/highlight]
Next
Close 1
End Sub
'REPLICAR A FORMULA CONCATENADORA PARA TODAS AS LINHAS DA TABELA
'CONTAR QUANTAS LINHAS NA TABELA DE CLIENTES
linhas = Sheets("CLIENTES").Range("A9").CurrentRegion.Rows.Count - 1
Sheets("txt").Range("A10:iv64000").Clear
Sheets("txt").Range("A9:A" & 9 + linhas).FillDown
'EXPORTAR A PLANILHA TXT
NOME_ARQUIVO = ThisWorkbook.Path & "\" & Sheets("CLIENTES").Range("CONVENIO").Value & "_" & Sheets("CLIENTES").Range("NOME_MES").Value & "_" & Sheets("CLIENTES").Range("ANO_REF").Value & ".TXT"
Open NOME_ARQUIVO For Output As 1
For LINHA = 9 To 9 + linhas
[highlight #CC0000] Print #1, Sheets("TXT").Cells(LINHA, 1).Value[/highlight]
Next
Close 1
End Sub
I need find some function to overrite the "Print", that doesn´t add a line in the end of the file.
I am sorry about my English and thank you!