Conversão de código...
 
Notifications
Clear all

Conversão de código VBA 32 bits para 64 bits

1 Posts
1 Usuários
0 Reactions
535 Visualizações
(@rafaelfcella)
Posts: 1
New Member
Topic starter
 

Prezados,

Tenho um programa VBA em Excel que faz a comunicação com um CLP. O programa original roda em windows 32 bits.

Fizemos a troca do PC para um 64 bits, e o programa não roda mais. Incluí o mais básico, que é a inclusão do PtrSafe após o Declare, mas mesmo assim dá erro, diz que não acha a dll (que está devidamente colocada na pasta correta).

Alguém saberia dizer o que posso fazer para corrigir?

A única alteração que fiz do código 32 bits para o 64 bits foi a inclusão do PtrSafe.

Declare PtrSafe Function OpenModbusSerial Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal conn_num As Long, ByVal baud_rate As Long, ByVal data_len As Long, ByVal parity As Byte, ByVal stop_bits As Long, ByVal modbus_mode As Long) As Long
Declare PtrSafe Sub CloseSerial Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal conn_num As Long)
Declare PtrSafe Function OpenModbusTCPSocket Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal conn_num As Long, ByVal ipaddr As Long) As Long
Declare PtrSafe Sub CloseSocket Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal conn_num As Long)
Declare PtrSafe Function RequestData Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal comm_type As Long, ByVal conn_num As Long, ByVal slave_addr As Long, ByVal func_code As Long, ByRef buf As Byte, ByVal DataLen As Long) As Long
Declare PtrSafe Function ResponseData Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal comm_type As Long, ByVal conn_num As Long, ByRef slave_addr As Long, ByRef func_code As Long, ByRef buf As Byte) As Long
Declare PtrSafe Function ReadSelect Lib "C:\DMT 2.0\Include\DMT.dll" (ByVal conn_num As Long, ByVal time_msec As Long) As Long
Declare PtrSafe Function GetLastSerialErr Lib "C:\DMT 2.0\Include\DMT.dll" () As Long
Declare PtrSafe Sub ResetSerialErr Lib "C:\DMT 2.0\Include\DMT.dll" ()
Declare PtrSafe Function GetLastSocketErr Lib "C:\DMT 2.0\Include\DMT.dll" () As Long
Declare PtrSafe Sub ResetSocketErr Lib "C:\DMT 2.0\Include\DMT.dll" ()

​​​​​​​Obrigado.

 
Postado : 10/10/2023 4:39 pm