#1
|
|||
|
|||
Change Userform Icon in Taskbar
I think I finally got all of my forms completed and working properly. Now I am trying to just do some cosmetic things.
Specifically, at this point, I am wanting to change the icon that shows in the taskbar for the userform. I want to change this: Into this: I've tried the following code, but have not had any success: Code:
Private Declare Function GetActiveWindow32 Lib "USER32" Alias _ "GetActiveWindow" () As Integer Private Declare Function SendMessage32 Lib "USER32" Alias _ "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function ExtractIcon32 Lib "SHELL32.DLL" Alias _ "ExtractIconA" (ByVal hInst As Long, _ ByVal lpszExeFileName As String, _ ByVal nIconIndex As Long) As Long Private Sub ChangeIcon() ChangeApplicationIcon End Sub Sub ChangeIcon() Dim Icon& Const NewIcon$ = "Image2" Icon = ExtractIcon32(0, NewIcon, 0) SendMessage32 GetActiveWindow32(), &H80, 1, Icon SendMessage32 GetActiveWindow32(), &H80, 0, Icon End Sub |
#2
|
||||
|
||||
You would do better to create a ribbon tab/button for your procedures. See http://gregmaxey.com/word_tip_pages/...bbon_main.html
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks again for always responding so quickly!
I may be missing something, so I just want to clarify. After looking over that information, I only see the option to change the Ribbon information. I am actually wanting to change the Icon that shows up in the taskbar at the bottom of the screen. Did I miss a section about that? |
#4
|
||||
|
||||
Is there a good reason why you are not using a valid filepath to the ico file as per the posts where it appears you sourced your code?
see http://stackoverflow.com/questions/2...-while-loading When I tested that code, it changed the icon in the app header and the icon associated with the app when Alt-tabbing through the available apps but didn't appear to change the icon in the already loaded taskbar. Perhaps that code needs to be run as the application is booting.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
Quote:
I was attempting to get an image that is not associated with a different application. Trying to piece together information from various sources, it was recommended that I include the .ico image I want to use on the userform and use it in the code, which is what I attempted to do in my code above. I do realize that I was doing that wrong as well and have attempted to correct it by using: Code:
Const NewIcon$ = Me.Image1.Picture.Handle |
#6
|
||||
|
||||
It appears from the screen shot in the URL I posted that it can be done but there may be a couple of reasons why it doesn't work for us.
It might work in earlier versions of Windows but not in the version I have running (Windows 10) It might not work if the application is pinned to the start menu (according to some other threads found with Google)
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#7
|
|||
|
|||
FYI - I was able to figure it out after almost a week of trying..
It appears that the coding must be included in both the ThisDocument object and the Userform coding. |
#8
|
|||
|
|||
Hi
You mentioned to add the code in 'ThisDocument' object. Could you please clearly explain what is 'thisdocument' object and what is the code needs to be there? Where I have to enter the code you initially provided. Sorry I'm newbie |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OneNote Icon on Taskbar Query | kevitec57 | OneNote | 0 | 03-22-2016 06:37 AM |
Taskbar icon always moves when saving Adobe PDF from Word | WaltR | Word | 0 | 10-03-2015 09:41 AM |
Change parent for control from frame to userForm? | Cosmo | Word VBA | 0 | 05-30-2014 02:19 PM |
ICONS change to a different icon | lrmaps.423 | Windows | 0 | 04-11-2014 07:53 AM |
Change Contacts View icon folder to List | arthurshurn | Outlook | 0 | 10-29-2013 09:53 AM |