+ Reply to Thread
Results 1 to 18 of 18

[SOLVED] VBA Code to set Windows Taskbar auto hide to OFF

  1. #1
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    [SOLVED] VBA Code to set Windows Taskbar auto hide to OFF

    Hello Excel Professionals, this is my first post here.

    I found on the internet a VBA code that allows me to set the taskbar Auto Hide on. It works like a charm, perfect. The problem is that to set it back to OFF it does not work. I mean I need the taskbar autohide to set to OFF when I call the Sub UnhideTaskbar below. But it does not work at all. There are some other codes on the net that only hides the taskbar, but It doesn't work because it won't allow full screen to fill it'a place on the screen. So I must use the Auto Hide property.

    Again, The Goal is to Set taskbar AutoHide OFF. How can I do it?

    Thanks !

    CODE:
    Please Login or Register  to view this content.
    Last edited by claudiocustodio; 09-01-2021 at 12:35 PM.

  2. #2
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    I forgot to mention that I am using Excel Office 365.

    Thanks.

  3. #3
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,252

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    For me, both procedures work without any problems (Win 10, MSO 365 32-bit).

    Artik

  4. #4
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Interesting Artik that UnhideTaskbar Sub is working for you. I have tested it in two computers won't run on both. In fact the UnhideTaskbar Sub works as the HideTaskbar Sub, they both set the Auto hide to ON. Very strange my friend.

  5. #5
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Thats what I forgot to mention, My Windows version is 10 PRO , and in fact the UnhideTaskbar Sub works as the HideTaskbar Sub, they both set the Auto hide to ON on both computers. Very strange.
    Last edited by claudiocustodio; 08-28-2021 at 08:36 AM.

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,252

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    What bit version of Office are you using? 32 or 64-bit?

    Artik

  7. #7
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Thanks Artik for the question. Office is 64 Bits. I know in my code I am calling shell32.dll.
    What change should I make in my code?

  8. #8
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Complementing, the Function works because I am already using the PtrSafe.
    The problem is that UnhideTaskbar SUB also set the Auto Hide mode to ON. Not to OFF.

  9. #9
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    I am now sending my Excel sample file. Please check the attachment.
    I have created two "buttons" and assigned each Sub to it.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,252

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    I don't have a 64-bit version at the moment to check, but try to replace all code to
    Please Login or Register  to view this content.
    For you, the code between #Else and #End If will turn red. Do not worry about it. This fragment will not compile on your version.
    The code should work on both bit versions.

    Artik
    Last edited by Artik; 08-28-2021 at 07:36 PM. Reason: Correction of errors in the code

  11. #11
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Artik, you are a Genius, thank you so much.
    You code is showing some error, I could not find were the error is, maybe is some whrong character.
    But anyway, I saw that you changed the TYPE for hWnd to LongPtr.
    So I just changed that in my Original code and it worked like a Charm. Thank you so much!!
    IŽll also insert the code as you did to check the BIT Version.

    Don't know what to do to thank you more.

  12. #12
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,252

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Quote Originally Posted by claudiocustodio View Post
    Artik, you are a Genius
    I'm not a genius. It's a couple of years of experience.

    Quote Originally Posted by claudiocustodio View Post
    I saw that you changed the TYPE for hWnd to LongPtr.
    This is not the only change. Note that the SHAppBarMessage function type has also changed, from Long to LongPtr

    Quote Originally Posted by claudiocustodio View Post
    Thank you so much!!
    You're welcome. I also benefited from this thread.

    Artik

  13. #13
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: [SOLVED] VBA Code to set Windows Taskbar auto hide to OFF

    Ok Artik, Now if I change the SHAppBarMessage function type to LongPtr, the code won't work.
    But no problem, the code is working now.

    Thanks!

  14. #14
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,252

    Re: [SOLVED] VBA Code to set Windows Taskbar auto hide to OFF

    I would have been looking for the cause of the error for a long time if I had not run the code on the 64-bit version. I haven't noticed that abd_retval and abd_setval variables are incorrectly declared. Download the code from post # 10 again because I corrected it.
    The fact that the code after your corrections worked should be treated as a coincidence. It probably wouldn't work under certain circumstances.

    Artik

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,836

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  16. #16
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Thanks Artik for the help, but still the new code does not work . As I am not too advanced in VBA I don't know why. And yes, the fact that by only changing hWnd to LongPtr made my code work I don't know why!!!

  17. #17
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,155

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    On Excel 2010 64 Bit, the code given by Artik in message #10 works for me if the variable abd_retval is declared as "Variant" type.

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    07-12-2013
    Location
    brazil
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA Code to set Windows Taskbar auto hide to OFF

    Thanks Haluk and Artik. With Artik's code, but changing abd_retval to Variant works 100%.

    I consider this Thread concluded.

    Thanks all.

+ 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. Auto Close code preventing access to taskbar
    By JRC1 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-03-2017, 11:12 AM
  2. [SOLVED] Windows in Taskbar
    By faulknerp in forum Excel General
    Replies: 1
    Last Post: 06-22-2006, 09:50 PM
  3. [SOLVED] Windows in Taskbar
    By faulknerp in forum Excel General
    Replies: 2
    Last Post: 12-16-2005, 11:00 AM
  4. [SOLVED] Windows in taskbar
    By in forum Excel General
    Replies: 2
    Last Post: 03-08-2005, 01:06 PM
  5. why do windows in taskbar go away
    By j-dawg in forum Excel General
    Replies: 1
    Last Post: 02-16-2005, 01:16 PM
  6. Windows in Taskbar
    By jma in forum Excel General
    Replies: 0
    Last Post: 01-17-2005, 10:46 PM

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