Bottom of spreadsheet hidden by taskbar in full screen view

G

Guest

If you change Excel to Full Screen View and your taskbar is always on top (as
it normally is), the bottom of the spreadsheet is hidden behind the taskbar.
Does anyone know how to get around this without hiding the taskbar? I have
found that if I drag the taskbar to the bottom and then back up again, the
Excel window resizes itself correctly and the bottom of the spreadsheet is
visible again. Problem is, I want to do this from VBA! Can anyone help
please???
 
P

Peter Huang [MSFT]

Hi

Here is the code snippet which will reset the taskbar.
You may have a try.
Commonly this is a Shell issue, for detailed information you may also try
the newsgroup below.
microsoft.public.platformsdk.shell

Private Declare Function SHAppBarMessage Lib "shell32.dll" _
(ByVal dwMessage As Long, _
ByRef pData As APPBARDATA) _
As Long

Private Const ABS_AUTOHIDE As Long = &H1
Private Const ABM_GETTASKBARPOS As Long = &H5
Private Const ABM_GETSTATE As Long = &H4
Private Const ABM_SETSTATE As Long = &HA
Private Const ABM_SETAUTOHIDEBAR As Long = &H8

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Type APPBARDATA
cbSize As Long
hwnd As Long
uCallbackMessage As Long
uEdge As Long
rc As RECT
lParam As Long ' message specific
End Type

Private Function IsTaskbar_AutoHideEnabled() As Boolean
Dim abd As APPBARDATA
Dim Result As Long

IsTaskbar_AutoHideEnabled = False

Call SHAppBarMessage(ABM_GETTASKBARPOS, abd)
Result = SHAppBarMessage(ABM_GETSTATE, abd)
If (Result And ABS_AUTOHIDE) Then
Result = CBool(SHAppBarMessage(ABM_SETAUTOHIDEBAR, abd))
IsTaskbar_AutoHideEnabled = Result
End If
End Function


Sub Test()
Dim abd As APPBARDATA
Dim Result As Long
' Call SHAppBarMessage(ABM_GETTASKBARPOS, abd)
Result = SHAppBarMessage(ABM_GETSTATE, abd)

' Call SHAppBarMessage(ABM_SETAUTOHIDEBAR, abd)
Application.DisplayFullScreen = False
'If IsTaskbar_AutoHideEnabled = False Then
abd.lParam = Result Or ABS_AUTOHIDE
Call SHAppBarMessage(ABM_SETSTATE, abd)
'Else

abd.lParam = Result And Not ABS_AUTOHIDE
Call SHAppBarMessage(ABM_SETSTATE, abd)
'End If
Application.DisplayFullScreen = True

End Sub
Sub Macro1()


End Sub


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top