Application.DisplayFullScreen affecting any workbook I open

yearego021

New Member
Joined
Jan 19, 2025
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have a workbook that I want to open fullscreen. I'm using Application.FullScreen to accomplish this, but when I go to open a different workbook, it also opens full screen. The formula bar is also hidden. I think I've got the code I need just not set up right? Cancel as Boolean?? I have my close sub set up to undo the fullscreen, formula, and scroll bar changes, but don't think I have it set up right.
VBA Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_Open()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
'Set scoll area:
ws.ScrollArea = "$A$1:$Z$35"
Next ws

With Application
.DisplayFullScreen = True
End With

With ActiveWindow
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayWorkbookTabs = False
End With
End Sub
Private Sub Workbook_Close()
With Application
.DisplayFullScreen = False
.DisplayFormulaBar = True
End With

With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayWorkbookTabs = True
End With
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
when I go to open a different workbook, it also opens full screen.
Are you closing the first workbook before opening the one where full screen was set?
Did you put break points on beforeclose and close events to make sure they both run?
 
Upvote 0
After googling for 20 or 30 minutes I could find nothing as to why your close event would not fire for me. The below changes seem to work but I don't understand the need for the hack. Maybe someone else will know. BTW, it would be nice if you indented your code because without doing that, it's not much better than not using code tags at all. Most of the time I won't bother to read lotsa code without tags.
VBA Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Workbook_Close
End Sub

Private Sub Workbook_Open()
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
    'Set scoll area:
    ws.ScrollArea = "$A$1:$Z$35"
Next ws

With Application
    .DisplayFullScreen = True
End With

With ActiveWindow
    .DisplayHorizontalScrollBar = False
    .DisplayVerticalScrollBar = False
    .DisplayWorkbookTabs = False
End With

End Sub

Private Sub Workbook_Close()

With Application
    .DisplayFullScreen = False
    .DisplayFormulaBar = True
End With

With ActiveWindow
    .DisplayHorizontalScrollBar = True
    .DisplayVerticalScrollBar = True
    .DisplayWorkbookTabs = True
End With
ThisWorkbook.Saved = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,757
Messages
6,186,848
Members
453,379
Latest member
gabriellegonzalez

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top