View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default hide TASKBAR in Sub Workbook_open()

This seems to do it:

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

Private Declare Function SetWindowPos Lib "user32" _
(ByVal handleW1 As Long, _
ByVal handleW1InsertWhere As Long, ByVal w As Long, _
ByVal x As Long, ByVal y As Long, ByVal z As Long, _
ByVal wFlags As Long) As Long

Public Declare Function SetFocus Lib "user32" (ByVal hwnd As Long) As Long

Const TOGGLE_HIDEWINDOW = &H80
Const TOGGLE_UNHIDEWINDOW = &H40
Dim handleW1 As Long

Sub HideTaskbar()
handleW1 = FindWindowA("Shell_traywnd", "")
SetWindowPos handleW1, 0, 0, 0, 0, 0, TOGGLE_HIDEWINDOW
SetFocus FindWindowA("XLMAIN", Application.Caption)
End Sub

Sub UnhideTaskbar()
SetWindowPos handleW1, 0, 0, 0, 0, 0, TOGGLE_UNHIDEWINDOW
SetFocus FindWindowA("XLMAIN", Application.Caption)
End Sub


--
Jim Rech
Excel MVP
"Dago " wrote in message
...
| Hi,
|
| I have an Excel application that hides all bars
|
| With ActiveWindow
| DisplayHeadings = False
| DisplayOutline = False
| DisplayHorizontalScrollBar = False
| DisplayVerticalScrollBar = False
| DisplayWorkbookTabs = False
| End With
|
| but: I want the Windows TASKbar hidden as well to get a real full
| screen view.
| I want it to work in Windows 98, 2000 and XP and with Excel 97, and
| 2000
|
| The code should be in the Sub Workbook_open() in the ThisWorkBook
| VBAProject in Excel
|
| I've tried several pieces of code, which produce errors.
|
| Is there a piece of code that I can use to hide the Windows taskbar
| automatically upon opening the excel file?
|
| This code would be appreciated! If you're willing to help, please
| provide some instructions, as I am a relative novice...
|
| Thanks in advance!
|
| Dago
|
|
| ---
| Message posted from http://www.ExcelForum.com/
|