Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform Icon


Hello,

How do you set an icon/bitmap in the caption field of a userform?

Thanks all..


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=521752

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Userform Icon

Have a Userform with an Image control with in it the icon.
Get the icon in the control by clicking the file browser button in the
Picture property.
I don't think the properties of the Image control matter much, but Visible
would normally be False.

Then in the Userform have this code:

Option Explicit
Private Const ICON_SMALL = 0&
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

Then just load the form the normal way.


RBS



"gti_jobert" wrote
in message ...

Hello,

How do you set an icon/bitmap in the caption field of a userform?

Thanks all..


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile:
http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=521752


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
show icon caption bar in userform tom taol Excel Programming 1 February 26th 06 11:42 AM
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Activating userform and filling it with data form row where userform is activate Marthijn Beusekom via OfficeKB.com[_2_] Excel Programming 3 May 6th 05 05:44 PM
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:16 AM.

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

About Us

"It's about Microsoft Excel"