Forum Discussion

Joshua-Michael's avatar
Joshua-Michael
Copper Contributor
Mar 31, 2024

Macro Code help?

I would like to build a macro that restores my screen view to include the toolbar.  Any help appreciated. Here's my code currently:

Sub Assets()
'
' Page Macro
' Assets
'

'
Sheets("Assets").Select
Application.WindowState = xlNormal
Application.DisplayFullScreen = True
Range("A1").Select
' DoCmd.ShowToolbar "Ribbon", acToolbarYes ???????  Not sure how to use this or if appropriate.
End Sub

  • Joshua-Michael 

    DoCmd.ShowToolbar does not work in Excel; it is for Microsoft Access.

    To show the ribbon, you can use

     

    ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",TRUE)"

     

    (And the same line with FALSE instead of TRUE hides the ribbon)

    • Joshua-Michael's avatar
      Joshua-Michael
      Copper Contributor

      HansVogelaar 

      I do thank you for your reply. Perhaps I have asked for the wrong term for your solution still does not display what I seek.  So below I will post what I get with the routine and then what I would like to see with the routine, if you could advise further, thank you.

      With the code as mentioned:

      What I would like to have displayed:

       

      • HansVogelaar's avatar
        HansVogelaar
        MVP

        Joshua-Michael 

        Thanks for the screenshots. The one at the top shows Excel in Full Screen Mode.

        To turn off Full Screen Mode, use

         

        Application.DisplayFullScreen = False

         

        And if you want to turn it on:

         

        Application.DisplayFullScreen = True

Resources