icon on userform
I knew you would get it in the end!
RBS
"pswanie" wrote in message
...
worked!!!
thank you very much!! do appreciate
Phillip
"RB Smissaert" wrote:
Any normal .ico file will do.
Add the image control (this shows as a mountain and a sun in my control
Toolbox and is called Image)
Then right-click the control and do Properties
Go to picture and select it and then press the browse button and find and
add your .ico file.
Should work now.
RBS
"pswanie" wrote in message
...
wups....!!! that my problem.... what .ico file do i need? where do i
put
it?
where do i get it?
"RB Smissaert" wrote:
Have copied your exact code and added it to a UserForm1
Added an Image control and added an icon.
Made the Image control invisible.
Added a normal module with this:
Sub start()
Load UserForm1
UserForm1.Show
End Sub
Ran this code and all working as it should.
What version of Excel do you have.
What kind of .ico file did you use?
RBS
"pswanie" wrote in message
...
Option Explicit
Private Const ICON_SMALL = 0&
Private Const wm_seticon = &H80
Private Const ICON_BIG = 1&
Private Declare Function FindWindow _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias
"SendMessageA"
_
(ByVal hwnd As Long, ByVal wMsg
As
Long, _
ByVal wParam As Long, lParam As
Any)
As Long
Private Declare Function DrawMenuBar Lib "user32" _
(ByVal hwnd As Long) As Long
Private Sub UserForm_Initialize()
Dim hwnd As Long
Dim hIcon As Long
hIcon = Image1.Picture
If Val(Application.Version) = 9 Then
hwnd = FindWindow("ThunderDFrame", Me.Caption)
Else
hwnd = FindWindow("ThunderXFrame", Me.Caption)
End If
If hwnd < 0 Then
SendMessage hwnd, wm_seticon, ICON_SMALL, ByVal hIcon
SendMessage hwnd, wm_seticon, ICON_BIG, ByVal hIcon
DrawMenuBar hwnd
End If
End Sub
|