Forum Discussion
minimized ribbon not consistent
In the workbook_open, I inserted the codes below to minmize the ribbon,
but sometimes it isn't doing it.
there might be something wrong with the codes below
many thanks
If Application.CommandBars("Ribbon").Height >= 100 Then
SendKeys "^{F1}"
End If
Application.CommandBars("ply").Enabled = False
Application.DisplayFormulaBar = False
below are the images:
desired opening page
not minimizing the ribbon....
10 Replies
- Matt MickleBronze Contributor
Hey Lorenzo-
Hope you're doing well. Nice to see you on the forum again. Try using this code to minimize the ribbon:
Private Sub Workbook_Open() On Error GoTo ErrHandler: Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"",False)" Application.DisplayFormulaBar = False ErrHandler: If Err.Number > 0 Then _ MsgBox Err.Description, vbMsgBoxHelpButton, strMsgBox, Err.HelpFile, Err.HelpContext On Error GoTo 0 End Sub- Lorenzo KimBronze Contributor
Mr Mickle,
Thank you for taking time out to answer my query.
below is what I want for my worksheet page to look like:
there is still some lines above showing.. this is what my code does, only that it sometimes doesn't!
the code you provided is a little "too minimized", as below:
maybe a little more tweaking....
many many thanks
- Matt MickleBronze Contributor
Try this snippet instead. I've added in a DoEvents statement:
Private Sub Workbook_Open() If Application.CommandBars("Ribbon").Height >= 100 Then SendKeys "^{F1}", False DoEvents End If Application.CommandBars("ply").Enabled = False Application.DisplayFormulaBar = False End Sub