+ Reply to Thread
Results 1 to 6 of 6

Auto Hide Task Bar

  1. #1
    JohnUK
    Guest

    Auto Hide Task Bar

    Hi,
    Is there a piece of code that Auto Hides the Task Bar

    I am after the Task bar to hide when a workbook is open and come back after
    the workbook closes.

    Many thanks
    John

  2. #2
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    Hope this helps.. I have a task pane, is that the same?

    Private Sub Workbook_Open()

    Application.CommandBars("Task Pane").Visible = False

    End Sub

    Private Sub Workbook_Close()

    Application.CommandBars("Task Pane").Visible = True

    End Sub
    Google is your best friend!

  3. #3
    JohnUK
    Guest

    Re: Auto Hide Task Bar

    Thanks Bearacade, but it was the Task Bar and not the Task Pane I wanted. I
    could still use this on a different project though.
    I did however try changing the Task Pane to Bar, but it didnt want to know.
    Regards
    John

    "Bearacade" wrote:

    >
    > Hope this helps.. I have a task pane, is that the same?
    >
    > Private Sub Workbook_Open()
    >
    > Application.CommandBars("Task Pane").Visible = False
    >
    > End Sub
    >
    > Private Sub Workbook_Close()
    >
    > Application.CommandBars("Task Pane").Visible = True
    >
    > End Sub
    >
    >
    > --
    > Bearacade
    >
    >
    > ------------------------------------------------------------------------
    > Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
    > View this thread: http://www.excelforum.com/showthread...hreadid=550033
    >
    >


  4. #4
    Forum Contributor
    Join Date
    06-01-2006
    Posts
    324
    I am having a brain fart, I could for the LIFE of me figure out what task bar was.. haha.. ok.. here goes.. put all of this in ThisWorkbook


    Private Declare Function ShowWindow Lib "user32" _
    (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

    Private Declare Function FindWindow Lib "user32" _
    Alias "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long

    Private Declare Function FindWindowEx Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    ByVal hWnd2 As Long, _
    ByVal lpsz1 As String, _
    ByVal lpsz2 As String) As Long

    Sub TaskBar(blnValue As Boolean)
    Dim lngHandle As Long
    Dim lngStartButton As Long

    lngHandle = FindWindow("Shell_TrayWnd", "")

    If blnValue Then
    ShowWindow lngHandle, 5
    Else
    ShowWindow lngHandle, 0
    End If
    End Sub

    Private Sub Cmdhide()
    Dim A As Boolean
    A = False
    TaskBar (A)
    End Sub

    Private Sub Cmdunhide()
    Dim A As Boolean
    A = True
    TaskBar (A)
    End Sub

    Private Sub Workbook_Open()

    Call Cmdhide

    End Sub

    Private Sub Workbook_BeforeClose(Cancel As Boolean)

    Call Cmdunhide

    End Sub

  5. #5
    Dave Peterson
    Guest

    Re: Auto Hide Task Bar

    I wouldn't like your program if it changed the way I used windows.

    It's not nice to play with other people's window's settings.

    JohnUK wrote:
    >
    > Hi,
    > Is there a piece of code that Auto Hides the Task Bar
    >
    > I am after the Task bar to hide when a workbook is open and come back after
    > the workbook closes.
    >
    > Many thanks
    > John


    --

    Dave Peterson

  6. #6
    JohnUK
    Guest

    Re: Auto Hide Task Bar

    Hi Bearacade,
    It worked a treat. Sorry it took so long getting back to you, I have been away
    Many thanks
    Regards
    John

    "Bearacade" wrote:

    >
    > I am having a brain fart, I could for the LIFE of me figure out what
    > task bar was.. haha.. ok.. here goes.. put all of this in ThisWorkbook
    >
    >
    > Private Declare Function ShowWindow Lib "user32" _
    > (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    >
    > Private Declare Function FindWindow Lib "user32" _
    > Alias "FindWindowA" (ByVal lpClassName As String, _
    > ByVal lpWindowName As String) As Long
    >
    > Private Declare Function FindWindowEx Lib "user32" _
    > Alias "FindWindowExA" (ByVal hWnd1 As Long, _
    > ByVal hWnd2 As Long, _
    > ByVal lpsz1 As String, _
    > ByVal lpsz2 As String) As Long
    >
    > Sub TaskBar(blnValue As Boolean)
    > Dim lngHandle As Long
    > Dim lngStartButton As Long
    >
    > lngHandle = FindWindow("Shell_TrayWnd", "")
    >
    > If blnValue Then
    > ShowWindow lngHandle, 5
    > Else
    > ShowWindow lngHandle, 0
    > End If
    > End Sub
    >
    > Private Sub Cmdhide()
    > Dim A As Boolean
    > A = False
    > TaskBar (A)
    > End Sub
    >
    > Private Sub Cmdunhide()
    > Dim A As Boolean
    > A = True
    > TaskBar (A)
    > End Sub
    >
    > Private Sub Workbook_Open()
    >
    > Call Cmdhide
    >
    > End Sub
    >
    > Private Sub Workbook_BeforeClose(Cancel As Boolean)
    >
    > Call Cmdunhide
    >
    > End Sub
    >
    >
    > --
    > Bearacade
    >
    >
    > ------------------------------------------------------------------------
    > Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
    > View this thread: http://www.excelforum.com/showthread...hreadid=550033
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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