Full Screen Macro

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
823
An old set of macros that worked on Excel 97-2003 were used to completely clear the
screen of everything except the cells. I now have Excel 2013 and have transferred the
old file, and the macros do work except as shown below:
jkk12r.jpg

Here's my code:

Code:
Sub FullScreen()
'
' FullScreen Macro
' Macro recorded 2018-02-19 by Steve Case
'
' Keyboard Shortcut: Ctrl+f
'
    Application.DisplayFullScreen = True
    Application.CommandBars("Worksheet Menu Bar").Enabled = False
    Application.DisplayFormulaBar = False
    Application.CommandBars("Forms").Visible = False
    Application.CommandBars("Standard").Visible = False
    Application.CommandBars("Formatting").Visible = False
With ActiveWindow
        .DisplayHeadings = False
        .DisplayHorizontalScrollBar = False
        .DisplayVerticalScrollBar = False
        .DisplayWorkbookTabs = False
    End With
    ActiveSheet.DisplayPageBreaks = False
End Sub

And to restore tool bars here's that code:

Code:
Sub RestoreToolBars()
'
' RestoreToolBars Macro
' Macro recorded 2018-02-19 by Steve Case
'
' Keyboard Shortcut: Ctrl+u
'
   Application.DisplayFullScreen = False
    Application.CommandBars("Worksheet Menu Bar").Enabled = True
    Application.DisplayFormulaBar = True
    Application.CommandBars("Standard").Visible = True
    Application.CommandBars("Formatting").Visible = True


With ActiveWindow
        .DisplayHeadings = True
        .DisplayHorizontalScrollBar = True
        .DisplayVerticalScrollBar = True
        .DisplayWorkbookTabs = True
    End With
    ActiveSheet.DisplayPageBreaks = True
End Sub

Is there a line of code that I can add to make the unwanted
"(Excel Icon) MyFile[Compatability Mode] - Excel (View & Exit)"
disappear and reappear?

Background:

My hard drive crashed and Windows 2010 was reinstalled on a new hard drive with
my old office 2003 but the Excel 97-2003 that had been running now doesn't and I
have Excel 2013 now.* I am very unhappy about this as Excel 2013 does things I
don't need or want, and those things that used to take two clicks now take 3 or 4
and are renamed, relocated and in some cases aren't there, I.e., the "Forms" toolbar
with all the buttons which you see in the "My File" image above.

Oh! I use this feature with [Alt-Tab] "Print Screen" to paste into a 640x480 pixel blank
in a graphics program so that it always is located in the upper left corner. That unwanted
top bar ruins the the technique.

*I'm not exactly sure what I had before - my old files on a thumb drive say Excel 1997-2003
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
.
Code:
Sub hide_menu()


With Worksheets("Sheet1")


    With ActiveWindow
        .DisplayHorizontalScrollBar = False
        .DisplayVerticalScrollBar = False
    End With
    With Application
        .DisplayFullScreen = True
        .DisplayFormulaBar = False
        .DisplayStatusBar = False
    End With
    With Application
    
        .CommandBars("Full Screen").Visible = False
        .CommandBars("Worksheet Menu Bar").Enabled = False
        .CommandBars("Standard").Visible = False
        .CommandBars("Formatting").Visible = False
    End With
End With
End Sub


Sub unhide_menu()


With Worksheets("Sheet1")


    With ActiveWindow
        .DisplayHorizontalScrollBar = True
        .DisplayVerticalScrollBar = True
    End With
    With Application
        .DisplayFullScreen = False
        .DisplayFormulaBar = True
        .DisplayStatusBar = True
    End With
    With Application
        .CommandBars("Full Screen").Visible = True
        .CommandBars("Worksheet Menu Bar").Enabled = True
        .CommandBars("Standard").Visible = True
        .CommandBars("Formatting").Visible = True
    End With
End With
End Sub
 
Upvote 0
Logit,

Thanks, but it doesn't work, that top bar is still there.

I tried just using and or changing bits & pieces of your code and it still didn't work.

Does it work on your machine. Did the My File [Compatibility Mode] etc. disappear for you?

Does that top line/bar have a name?

Best regards
Steve Case
 
Upvote 0
Upvote 0
.
This is how it is displayed here :

https://www.amazon.com/clouddrive/share/yEqW8C5WiN4olI2ehlfMlnuzMjaeIJMYQHwj9SVDGdV


I'm not certain if you can remove that last strip of the worksheet shown at the top without delving further into API calls. Looked around the NET but did not locate anything that would remove
that last strip.

What is your goal of removing everything ?

I mentioned my reason in the first post. But to expand on that,
you know, people, like me, use things for unintended purposes.
And in this case, a screen print of the full screen will paste in most,
probably all graphics programs in the upper left hand corner. And
as it turns out, good old Microsoft Photo editor that's been around
forever, will just simply not paste what extends beyond the right
and lower margins of whatever size blank image you've set up.
So it makes it very easy to create graphics in excel that will paste
exactly to the pixel where you want them. In my case I'm illustrating
with either an animated GIF or a video and conditional formatting
how one data set compares to another. It shows which cells change
and which ones don't between certain sets of circumstances.

Dunno if that explains it.

Thanks for doing the search - wasn't what I wanted to hear, but I
suspected as much.
 
Upvote 0
.
Don't give up. Someone else may have a different answer for you. I do suspect though it will involve a greater involvement with the Windows API.
 
Upvote 0
Here is an alteernative you may want to try :
Code:
Option Explicit

[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=If]#If[/URL]  VBA7 Then
    [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=If]#If[/URL]  Win64 Then
        Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
    [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else]#Else[/URL] 
        Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPtr
    [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End]#End[/URL]  If
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else]#Else[/URL] 
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End]#End[/URL]  If

Private Property Let ShowRealFullScreen(ByVal Show As Boolean)
    With Application
        .ActiveWindow.DisplayHorizontalScrollBar = Not Show
        .ActiveWindow.DisplayVerticalScrollBar = Not Show
        .ActiveWindow.DisplayHeadings = Not Show
        .ActiveWindow.DisplayWorkbookTabs = Not Show
        .DisplayFullScreen = Show
        .DisplayFormulaBar = Not Show
        .DisplayStatusBar = Not Show
        SetWindowLong .hwnd, -16, IIf(Show, &H150F0000, &H14CF0000)
    End With
End Property

Sub hide_menu()
    ShowRealFullScreen = True
End Sub

Sub unhide_menu()
    ShowRealFullScreen = False
End Sub
 
Upvote 0
Jaafar,

Thanks for the reply, I pasted your code replacing my code except for the name as following code shows:

Code:
Sub FullScreen()
Option Explicit


[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=If]#If[/URL]   VBA7 Then
    [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=If]#If[/URL]   Win64 Then
        Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
    [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else]#Else[/URL]  
        Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPtr
    [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End]#End[/URL]   If
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=Else]#Else[/URL]  
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
[URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=End]#End[/URL]   If


Private Property Let ShowRealFullScreen(ByVal Show As Boolean)
    With Application
        .ActiveWindow.DisplayHorizontalScrollBar = Not Show
        .ActiveWindow.DisplayVerticalScrollBar = Not Show
        .ActiveWindow.DisplayHeadings = Not Show
        .ActiveWindow.DisplayWorkbookTabs = Not Show
        .DisplayFullScreen = Show
        .DisplayFormulaBar = Not Show
        .DisplayStatusBar = Not Show
        SetWindowLong .hwnd, -16, IIf(Show, &H150F0000, &H14CF0000)
    End With
End Property


Sub hide_menu()
    ShowRealFullScreen = True
End Sub


Sub unhide_menu()
    ShowRealFullScreen = False
End Sub

and this dialog box came up:

Compile error:
Only comments may appear after End Sub,End Function, or End Property

That's my first run-through I'll try some other stuff (-:

Uh like removing

Code:
Sub hide_menu()
    ShowRealFullScreen = True
End Sub


Sub unhide_menu()
    ShowRealFullScreen = False
End Sub
 
Upvote 0
If you remove that it wont work at all. His code was complete, as is...it doesn't go between Sub/End Sub. Paste it into a blank module and try running the macro "hide_menu".
 
Upvote 0
Jaafar

Thank You Thank You Thank You Thank You Thank You Thank You Thank You

I removed all my stuff, replaced it with your stuff, assigned my two buttons [FullScreen] & [Restore Tool Bars] as appropriate and:

It Worked like a champ (-:
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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