+ Reply to Thread
Results 1 to 11 of 11

Giving VBA UserForm task bar icon

  1. #1
    Registered User
    Join Date
    06-29-2016
    Location
    Bristol, UK
    MS-Off Ver
    2010
    Posts
    23

    Giving VBA UserForm task bar icon

    I am trying to give my Excel UserForm application a task bar icon as on load it hides the Excel workbook which make the form(s) easy to lose behind other windows. I have a .png or an .ico file which I would like to use as the icon. The image can either be just in the folder with the Excel file but if it could be embedded some way into the workbook that would be preferable.

    Thanks for any help!

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Giving VBA UserForm task bar icon

    Hi,

    There are many examples of code for this scattered throughout the internet. Have you tried any of them? For example this- http://stackoverflow.com/questions/2...in-the-taskbar
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    06-29-2016
    Location
    Bristol, UK
    MS-Off Ver
    2010
    Posts
    23

    Re: Giving VBA UserForm task bar icon

    Hi,

    I have tried several but to no avail. They generally seem to show some code with no explanation of what they are doing which makes it hard to adapt to my implementation, nor can I see how to change the icon used to be a custom one. Hence why I am trying to find someone who can explain a solution for me

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Giving VBA UserForm task bar icon

    Add a new class module and name it UserformHandler. Next, add the following code to the class module
    Please Login or Register  to view this content.
    Finally, in any userform you will then require code like this
    Please Login or Register  to view this content.
    You must use a valid icon format file for this to work properly.

  5. #5
    Registered User
    Join Date
    06-29-2016
    Location
    Bristol, UK
    MS-Off Ver
    2010
    Posts
    23

    Re: Giving VBA UserForm task bar icon

    Thanks for the response!

    I am a bit unsure what you mean by "specify your image control here instead of Image1"?

    Sorry for the level of noob...

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Giving VBA UserForm task bar icon

    You need to have a picture loaded somewhere. Usually it would be in an image control on the form itself, in which case you merely need to use the relevant control name in that line rather than the default Image1.

  7. #7
    Registered User
    Join Date
    06-29-2016
    Location
    Bristol, UK
    MS-Off Ver
    2010
    Posts
    23

    Re: Giving VBA UserForm task bar icon

    Right. I have it working now with an .ico file and the forms icon is changed but the task bar icon is still the Excel icon. Is this code meant to change that too? Or have I missed something?

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Giving VBA UserForm task bar icon

    The code doesn't change the taskbar icon in Windows 7 or later, I don't believe, since that is the program icon, not the window icon. It will show the form as a preview window when you hover over the taskbar icon.

  9. #9
    Registered User
    Join Date
    06-29-2016
    Location
    Bristol, UK
    MS-Off Ver
    2010
    Posts
    23

    Re: Giving VBA UserForm task bar icon

    That's fine then. Thanks for all your help!

  10. #10
    Registered User
    Join Date
    01-22-2018
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    1

    Question Re: Giving VBA UserForm task bar icon

    Quote Originally Posted by xlnitwit View Post
    Add a new class module and name it UserformHandler. Next, add the following code to the class module
    Please Login or Register  to view this content.
    Finally, in any userform you will then require code like this
    Please Login or Register  to view this content.
    You must use a valid icon format file for this to work properly.
    With this one, is it possible to disable the close or "x" with the minimize button? just to ensure they click a separate exit button that will also exit the application and not just the userform. Unless there is a way to code the close button to exit Excel and open up that window instead?

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Giving VBA UserForm task bar icon

    Sajiko,

    Welcome to the forum.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Different ways Of changing Userform's ICON in the title?
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2016, 06:23 PM
  2. Insert icon in listview userform
    By AqieqS in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 11-24-2014, 07:12 AM
  3. [SOLVED] Simple UserForm with Calendar Icon
    By excellenthelp in forum Excel Programming / VBA / Macros
    Replies: 45
    Last Post: 07-29-2013, 01:43 PM
  4. Windows XP : How do i remove icon from my task-bar ?
    By Reema in forum Microsoft Windows Help
    Replies: 1
    Last Post: 11-28-2009, 07:17 AM
  5. Userform Icon
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2007, 01:57 PM
  6. Userform Icon
    By gti_jobert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2006, 03:25 PM
  7. show icon caption bar in userform
    By tom taol in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2006, 07:45 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1