PDA

View Full Version : Solved: DisplayFullScreen Question



dragon576
09-11-2007, 02:37 AM
Hi,
I'm using the following code to ensure only my toolbar is visable on any worksheet .

Private Sub worksheet_activate()
On Error Resume Next
With Application
.DisplayFullScreen = True
.CommandBars("My toolbar").Enabled = True
.CommandBars("Worksheet Menu Bar").Enabled = False
End With
On Error GoTo 0
End Sub

Works fine except the vertical scrollbar is visible and the horizontal is not.

Ideally I need a way to keep both scrollbars, and even the worksheet tabs whilst having main menus/default toolbars hidden. I have been unable to find a properties element for fullscreen except for userforms.

Can anyone help? I've searched for scrollbars and displayfullscreen but have not found an answer yet.

Thanks

Doug

Bob Phillips
09-11-2007, 02:48 AM
How about



Private Sub worksheet_activate()
On Error Resume Next
With Application
.WindowState = xlMaximized
.CommandBars("My toolbar").Enabled = True
.CommandBars("Worksheet Menu Bar").Enabled = False
End With
On Error GoTo 0
End Sub

rory
09-11-2007, 02:51 AM
Do you have the windows taskbar set to auto hide?

dragon576
09-11-2007, 03:43 AM
Interesting.

If I use .WindowState = xlMaximized by itself, I still have the default toolbars (not wanted), but have the scroll bars and tabs(wanted).

If I just use DisplayFullScreen = true and autohide the windows taskbar, it works.

I also tried a combination of the both with either the windowstate before or after the displayfullscreen, with little joy.

So if I hide the default toolbars (you know another questions coming don't you) then this would in theory provide the functionality I want, or force the users to change the windows taskbar to autohide (can this be done in Excel?).

Any suggestions while I go and browse the objects?

thanks

Doug

Bob Phillips
09-11-2007, 03:59 AM
Dim oCB As CommandBar
For Each oCB In Application.CommandBars
oCB.Enabled = False
Next oCB

mFormulaBar = Application.DisplayFormulaBar
Application.DisplayFormulaBar = False


and reset afterwards

rory
09-11-2007, 04:09 AM
I would go with the loop xld's given you - changing taskbar settings is one of those things (like changing a user's screen resolution) that I personally would find unacceptable.

dragon576
09-11-2007, 05:22 AM
Thanks guys, that works better.
I have a custom toolbar which should not be used on the first worksheet, so needed it disabling, and I also needed to remove clutter from the toolbar area to make mine more obvious and the entire workbook more user friendly.

But I also need the scrollbars for the same reason.

I am inclined to leave the menus there to prevent users calling be at all times of the day of night and just remove the toolbars now I have it working.

Thanks
again

Doug