0
I have a code that always puts 264 empty characters after the last word typed inside the cell; then puts more "00000000000000" after 264 empty characters and export to txt, as shown below:
My question is I have to put at the end of the line after the 264 characters always "99999999999" that in the cell is with the following field filled : 5497558138889999999999998
Follows my code:
Sub Macro14()
Application.ScreenUpdating = False
Dim arq1 As Long
Dim name As String
Dim op As Variant
Dim linha As Long
Dim res As String
On Error GoTo fim:
linha = 1
While ThisWorkbook.Sheets("TesteConcluido").Cells(linha, 1) <> ""
name = ThisWorkbook.Sheets("TesteConcluido").Cells(linha, 1)
While Len(name) < 265
name = name + " "
Wend
If linha = 42 And 43 Then
name = name & "999999999990000"
Else
name = name & "000000000000000"
End If
arq1 = FreeFile
Open fileTeste For Append As arq1
Print #arq1, name
Close #arq1
linha = linha + 1
Wend
fim:
If Err.Number = "70" Then
Resume
End If
MsgBox "O arquivo foi exportado com sucesso! ", vbInformation, "Exportar arquivos"
res = MsgBox("Você gostaria voltar ao menu?", vbYesNo + vbQuestion, "QNIS - CAIXA")
If res = vbYes Then
Else
ThisWorkbook.Close savechanges:=True
Unload FormQNIS
End If
Application.ScreenUpdating = True
End Sub
Could you mark some answers to the questions you asked as accepted and answered. This way more people will be willing to help you. For more information about Sopt, read the Community FAQ
– danieltakeshi
All right I answered the other questions, thank you
– WillGreco