Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Icon Sets - Display icon in one cell depending upon value in anoth Nolene Excel Worksheet Functions 2 February 26th 10 05:43 AM
Tom Ogilvy -- Center Userform Below Calling Toobar Icon Zone[_2_] Excel Programming 2 March 28th 07 02:50 AM
Userform Icon gti_jobert[_55_] Excel Programming 1 March 13th 06 07:21 PM
show icon caption bar in userform tom taol Excel Programming 1 February 26th 06 11:42 AM
disable or hide the close window icon 'X' in the corner of a userform Tim[_39_] Excel Programming 4 September 24th 04 02:06 PM


All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"