Invoke code is not working

Hello everyone,

I need to convert a TXT file with UNIX encoding for Windows, I found a solution in Vba, but I can’t insert it in the code, could you help me?

Sub ConverterDeUnix()
'ahteixeira 2016 para MaximoAccess

Dim fOrigem$, fDestino$, Linha$

fOrigem = “C:\FEBRABAN\OI_UNIX.txt”

fDestino = “C:\FEBRABAN\OI_UNIX_Convertido.txt”

Open fOrigem For Input Access Read As #1

Line Input #1, Linha
If EOF(1) Then
Linha = Replace(Linha, vbLf, vbCrLf)
Close #1
Open fDestino For Output Access Write As #1
Print #1, Linha
Close #1
Close #1
End If
End Sub

Hey @Israel_Silva

Are just looking to insert the code?

If so, Try the “Invoke Code” activity.


Hopefully this helps.


Yes, I am using the “Invoke Code” activity… but it has the errors attached.


Your code seems not but VBA or VB6. If you want to use VBA, can you try to use Invoke VBA activity with Excel?


1 Like


Hello Israel,
you can find a possible solution here, without Invoke Code Activity.
Best regards


Hello Israel,
@Yoichi is right, it is not possible to execute copied VBA code in an Invoke Code activity. The approach of the Invoke Code activity is different, that’s why you have all the error messages. You can find more information about Invoke Code Activity in the documentation.
Best regards