The project I'm working on has a bit of code in the workbook open event that makes excel go full screen, hide any toolbars that a user has configured to run in fullscreen (and make a note so they can be restored on exit) and loads a custom toolbar.
Application.DisplayFullScreen = True
Dim MyBar As CommandBar
Dim MyPopup As CommandBarPopup
Dim MyButton As CommandBarButton
On Error Resume Next
CommandBars("MAPS").Delete
On Error GoTo 0
Set MyBar = CommandBars.Add(Name:="MAPS", Position:=msoBarTop, temporary:=True)
With MyBar
Set MyButton = .Controls.Add(Type:=msoControlButton)
With MyButton
.Caption = "Exit"
.Style = msoButtonCaption
.OnAction = "Exit"
End With
.Visible = True
End With
Dim cb As CommandBar
Dim cblog As Integer
Dim cbcol As Integer
Dim cbname As String
cblog = 1
cbcol = 6
For Each cb In Application.CommandBars
cbname = cb.Name
If cbname = "MAPS" Then GoTo 100
If cbname = "Worksheet Menu Bar" Then GoTo 100
If cblog = 15 Then
cblog = 1
cbcol = cbcol + 1
End If
If Application.CommandBars(cbname).Visible = True Then
Cells(cblog, cbcol).Value = cb.Name
Application.CommandBars(cbname).Visible = False
cblog = cblog + 1
End If
100
Next cb
Set cb = Nothing
Application.CommandBars("Worksheet Menu Bar").Enabled = False
Application.DisplayCommentIndicator = xlNoIndicator
This works perfectly in excel 2003. However, in excel 2007 going full screen still leaves the windows control buttons at the top right of the window and no custom toolbar appears.
Two questions:
a) how do I make the code create a custom toolbar in excel 2007 and still be compatible with 2003?
b) Is there a way to remove the windows controls from a fullscreened excel 2007 like 2003 is?