Macro Code help?

Copper Contributor

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

4 Replies

@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)

@Hans Vogelaar 

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:

JoshuaMichael_0-1711926058953.png

What I would like to have displayed:

JoshuaMichael_1-1711926135041.png

 

@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

Again, thank you for your help! That still did not work. However, I found that this combination of code does what I require. All the best, my colleague.
ActiveWindow.WindowState = xlMinimized
Application.WindowState = xlNormal