Results 1 to 9 of 9

code for hiding taskbar

Threaded View

  1. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: code for hiding taskbar

    Hello ditisFloris,

    Copy this code into a separate VBA module in your workbook. Call the macro ShowFullScreen in your code. Be sure to call ShowNormalScreen before you close the workbook.
    'Written: January 19, 2011
    'Author:  Leith Ross
    'Summary: Macros to hide and show the Windows Taskbar. Works with Windows '95 - 2003.
    '         Does not work with Vista. There are two additional macros to set the display
    '         to full screen and restore the display to normal.
    
    Private Declare Function FindWindow _
      Lib "User32.dll" Alias "FindWindowA" _
        (ByVal lpClassName As String, _
         ByVal lpWindowName As String) As Long
     
    Private Declare Function SetWindowPos _
      Lib "User32.dll" _
        (ByVal hWnd As Long, _
         ByVal hWndInsertAfter As Long, _
         ByVal X As Long, _
         ByVal Y As Long, _
         ByVal cx As Long, _
         ByVal cy As Long, _
         ByVal uFlags As Long) As Long
     
    Const HWND_TOP As Long = &H0&
    Const SWP_HIDEWINDOW As Long = &H80&
    Const SWP_SHOWWINDOW As Long = &H40&
    
    Sub HideTaskbar()
      Dim Taskbar As Long
        Taskbar = FindWindow("Shell_traywnd", "")
        Call SetWindowPos(Taskbar, HWND_TOP, 0, 0, 0, 0, SWP_HIDEWINDOW)
    End Sub
     
    Sub UnhideTaskbar()
      Dim Taskbar As Long
        Taskbar = FindWindow("Shell_traywnd", "")
        Call SetWindowPos(Taskbar, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW)
    End Sub
    
    Sub ShowFullScreen()
    
          HideTaskbar
          
            With Application
              .DisplayFullScreen = True
              .CommandBars("Worksheet Menu Bar").Enabled = False
            End With
            
            With ActiveWindow
              .DisplayHeadings = False
              .DisplayHorizontalScrollBar = True
              .DisplayVerticalScrollBar = True
              .DisplayWorkbookTabs = True
           End With
          
    End Sub
    
    Sub ShowNormalScreen()
    
          UnhideTaskbar
          
            With Application
              .DisplayFullScreen = False
              .CommandBars("Worksheet Menu Bar").Enabled = True
            End With
            
            With ActiveWindow
              .DisplayHeadings = True
              .DisplayHorizontalScrollBar = True
              .DisplayVerticalScrollBar = True
              .DisplayWorkbookTabs = True
           End With
    
    End Sub
    Last edited by Leith Ross; 01-20-2011 at 10:17 PM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

Thread Information

Users Browsing this Thread

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

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