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?

Code
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
Else
Close #1
End If
End Sub

Hey @Israel_Silva

Are just looking to insert the code?

If so, Try the “Invoke Code” activity.

image

Hopefully this helps.

Cheers

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

Hi,

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

Regards,

1 Like

@Israel_Silva

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

@Israel_Silva

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
Stefan

Thankyouuuu

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.