Hello SuitedAces,
The code looks fine. So, I am going to ask an obvious question, did you copy the macro into a Standard VBA Module?
Sincerely,
Leith Ross
Hello SuitedAces,
I hope this reply posts. The following code conatins two macros, one to hide, and the other to show the Task Bar. These actually set or clear the visible property through the API. A word of caution, hiding the Task Bar will lock out the Launch Bar which means you can't switch tasks by clicking on the icon. This why the Task Bar as an "Auto Hide" feature. This feature really minimizes the Task Bar (to a few pixels in height) and doesn't lock out the Launch Bar.
Sincerely,'Written: October 30, 2007 'Author: Leith Ross 'Summary: Hide or Show the System Tray by setting or clearing the Visible bit. Private Const GWL_STYLE = (-16) Private Const WS_VISIBLE As Long = &H10000000 Private Declare Function GetWindowLong _ Lib "user32.dll" _ Alias "GetWindowLongA" _ (ByVal hWnd As Long, _ ByVal nIndex As Long) As Long Private Declare Function SetWindowLong _ Lib "user32.dll" _ Alias "SetWindowLongA" _ (ByVal hWnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function FindWindowEx _ Lib "user32" Alias "FindWindowExA" _ (ByVal hwndParent As Long, _ ByVal hwndChildAfter As Long, _ ByVal lpszClass As String, _ ByVal lpszWindow As String) As Long Public Function IsTaskbarVisible() As Boolean Dim hWnd As Long Dim Ret As Long hWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString) Ret = GetWindowLong(hWnd, GWL_STYLE) If Ret And WS_VISIBLE Then IsTaskbarVisible = True End Function Public Sub HideTaskBar() Dim hWnd As Long Dim Ret As Long Dim WinStyle As Long hWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString) WinStyle = GetWindowLong(hWnd, GWL_STYLE) WinStyle = WinStyle And (Not WS_VISIBLE) Ret = SetWindowLong(hWnd, GWL_STYLE, WinStyle) X = Hex(WinStyle) End Sub Public Sub ShowTaskBar() Dim hWnd As Long Dim Ret As Long Dim WinStyle As Long hWnd = FindWindowEx(0, 0, "Shell_TrayWnd", vbNullString) WinStyle = GetWindowLong(hWnd, GWL_STYLE) WinStyle = WinStyle Or WS_VISIBLE Ret = SetWindowLong(hWnd, GWL_STYLE, WinStyle) X = Hex(WinStyle) End Sub
Leith Ross
Yes Leith I had it in a standard moduleOriginally Posted by Leith Ross
Thank you Leith .Originally Posted by Leith Ross
But I don't truely meet my objective here with being able to toggle the taskbar by way of returning a value that indicates whether the taskbar is hidden or displayed.
When I use one of the previous codes in excel 2007, it makes the task bar invisible but it will show the start button.
is the code for 2007 different? and does anybody know how to temporarily fully remove the task bar with VBA?
Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks