Vídeo recomendado
https://youtu.be/diWPPPhW-9E

PROBLEMA DE COMPATIBILIDADE VBA 64 E 32 [VB / VBA]

Dúvidas gerais sobre Excel
lucaslc7
Acabou de chegar
Acabou de chegar
Mensagens: 1
Registrado em: Qui Jan 02, 2014 1:02 pm

PROBLEMA DE COMPATIBILIDADE VBA 64 E 32 [VB / VBA]

Mensagem por lucaslc7 »

:oops: tenho dois computadores e ultilizo um codico vba para facilitar a vida, fiz o codigo com api de 32bits ai nao funcionou no 64 bits arrumei inserindo ptrsafe
para 32

Código: Selecionar todos

  
Option Explicit
Private Declare  Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare  Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare  Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare  Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
 
para 64

Código: Selecionar todos

Option Explicit
Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare  PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long

ai nao funciona no 32, assim nao da ne, nao posso ficar corrigindo isso sempre.
espero a ajuda obrigado


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


Avatar do usuário
Mikel Silveira Fraga
Jedi
Jedi
Mensagens: 1173
Registrado em: Sex Mai 27, 2011 3:27 pm
Localização: Governador Valadares - MG
Contato:

Re: PROBLEMA DE COMPATIBILIDADE VBA 64 E 32 [VB / VBA]

Mensagem por Mikel Silveira Fraga »

Lucas, boa noite e seja bem vindo ao fórum.

Sobre este teu erro, dê uma olhada no link abaixo:
Compatibilidade de Chamadas API no VBA

Abraços.


Marcosgn27
Acabou de chegar
Acabou de chegar
Mensagens: 1
Registrado em: Ter Abr 16, 2019 4:10 pm

Re: PROBLEMA DE COMPATIBILIDADE VBA 64 E 32 [VB / VBA]

Mensagem por Marcosgn27 »

Acrescente esta condição

#If Win32 Then

#Else

#End if


Disable adblock

This site is supported by ads and donations.
If you see this text you are blocking our ads.
Please consider a Donation to support the site.


Responder