Notifications
Clear all

ERRO COMANDO

3 Posts
2 Usuários
0 Reactions
989 Visualizações
(@tarcisio2k)
Posts: 2
New Member
Topic starter
 

Boa Noite, Caros

Estou tentando fazer um comando para que a macro identifique a versão do windows e aplique a formula, porem ocorre o seguinte erro.

"ERRO DE COPILAÇÃO, ERA ESPERADO O FIM DA INSTRUÇÃO

Segui...

Private ptrsafe Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) as longptr

Private ptrsafe Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hwnd as longptr, ByVal nIndex as longptr) as longptr

Private ptrsafe Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hwnd as longptr, ByVal nIndex as longptr, ByVal dwNewLong as longptr) as longptr

Private ptrsafe Function DrawMenuBar Lib "User32" (ByVal hwnd as longptr) as longptr

#If Win64 Then
Public Indice As LongPtr
#Else
Public Indice As Long
#End If

 
Postado : 23/02/2016 2:34 pm
Trindade
(@trindade)
Posts: 278
Reputable Member
 

Boa tarte,

Teste assim:

#If VBA7 Then

Private Declare PtrSafe Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As LongPtr) As LongPtr
Private Declare PtrSafe Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As LongPtr, ByVal dwNewLong As LongPtr) As LongPtr
Private Declare PtrSafe Function DrawMenuBar Lib "User32" (ByVal hwnd As LongPtr) As LongPtr

#Else

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 LongPtr, ByVal nIndex As LongPtr) As Long
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As LongPtr, ByVal dwNewLong As LongPtr) As Long
Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As LongPtr) As Long

#End If

Se a resposta foi útil! Clique na mãozinha ao lado do botão Citar.
Sua dúvida foi respondida? Marque como RESOLVIDO em seus tópicos, usando o botão com marca verde.

 
Postado : 23/02/2016 2:59 pm
(@tarcisio2k)
Posts: 2
New Member
Topic starter
 

Boa Tarde, Trindade

Me desculpe a demora estava viajando. Certo Irei testar.

 
Postado : 26/02/2016 11:04 am