Bom depois de algum pensamento aqui encontrei a solução:
Adicionei estes campos:
SendMessage GetWindow(hwndIcon, GW_OWNER), WM_SETICON, ICON_SMALL, hwndIcon
SendMessage GetWindow(hwndIcon, GW_OWNER), WM_SETICON, ICON_BIG, hwndIcon
mais os outros dois acima
e alterei o option Explicit para :
Option Explicit
'Declaring the necessary API functions and constants.
#If VBA7 And Win64 Then
'For 64 bit Excel.
Private Declare PtrSafe Function ExtractIconA Lib "shell32.dll" _
(ByVal hInst As LongPtr, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As LongPtr
Private Declare PtrSafe Function SendMessageA Lib "user32" _
(ByVal hwnd As LongPtr, _
ByVal wMsg As Long, _
ByVal wParam As LongPtr, _
ByVal lParam As LongPtr) As LongPtr
Private Declare PtrSafe Function GetWindow _
Lib "user32.dll" Alias "GetWindowLongPtrA" ( _
ByVal hwndIcon As LongPtr, _
ByVal nIndex As Long) As LongPtr
Private Const ICON_SMALL As LongPtr = 0&
Private Const ICON_BIG As LongPtr = 1&
Dim hwndIcon As LongPtr
#Else
'For 32 bit Excel.
Private Declare Function ExtractIconA Lib "shell32.dll" _
(ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function SendMessageA Lib "user32" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Declare Function GetWindow _
Lib "user32.dll" Alias "GetWindowLongA" ( _
ByVal hwndIcon As Long, _
ByVal nIndex As Long) As Long
Private Const WM_SETICON As Long = &H80
Private Const ICON_SMALL As Long = 0&
Private Const ICON_BIG As Long = 1&
Private Const GW_OWNER = 2
Dim hwndIcon As Long
Obrigado a todos os que participaram, da próxima vez coloco o link à resposta.
respondi também para : https://gurudoexcel.com/forum/viewtopic ... 916#p20916
Abraços
João Santos
Postado : 07/03/2017 1:33 am