We help IT Professionals succeed at work.
Get Started

How to reduce height of xl application window - close to the xl Ribbon - and lock the height when that reduction is in force?

Kelvin4 asked
Last Modified: 2015-03-22
I seek to reduce the height of the Excel Application window for certain procedures in my Excel project.
I have a partial solution (via Application.Height = 151), but if I reduce the height to less than 151, the xl ribbon vanishes. I would like Application.height to be quite tight to the underside of the xl ribbon (I guess about 120)

Secondly, is there a way of locking/unlocking the height of the Application window so I have more control?
Else (?) detecting a change in window height as an event and over-riding that dimension change when I want it locked?


Sub setExcelWindowFeatures()  
    Dim appHeight As Long    
            'Change height of application window with appHeight
    appHeight = 151  'minimum height - else ribbon disappears
    With Application
        .WindowState = xlNormal
        .Top = 1
        .Left = 30
        .Width = 600
        .Height = appHeight
        With .ActiveWindow  'hide worksheets when application height is minimised
            If appHeight < 300 Then
                .Top = -700 'cannot hide all sheets, so place them out of window view when application
                .Top = 1
            End If        
        End With

    End With
End Sub
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE