How can I hide the excel application and add a system tray icon for the userform? I saw that there are previous code for this but I cannot make it work. Can anyone help me with this problem. Thank you everyone
This is the code that i'm looking at and I'm having a hard time applying this code. An error always comes up every time I run the macro
Compile Error: Type Mismatch
and it come from this part of the code
Private Sub AddIcon()
'Add an icon on the titlebar
Dim hWnd As Long
Dim lngRet As Long
Dim hIcon As Long
hIcon = Sheet1.Image1.Picture.Handle
hWnd = FindWindow(vbNullString, Me.Caption)
lngRet = SendMessage(hWnd, WM_SETICON, ICON_SMALL, ByVal hIcon)
lngRet = SendMessage(hWnd, WM_SETICON, ICON_BIG, ByVal hIcon)
lngRet = DrawMenuBar(hWnd)
End Sub
the highlighted part was this hWnd = FindWindow(vbNullString, Me.Caption)