ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vista/Excel 2007 VBA Determine if the Ribbon is minimized? (https://www.excelbanter.com/excel-programming/394426-vista-excel-2007-vba-determine-if-ribbon-minimized.html)

TomThumb

Vista/Excel 2007 VBA Determine if the Ribbon is minimized?
 
How can I programmatically determine if the Ribbon is minimized or not? I
need something like the imaginary function RibbonMinimized() as Boolean.
--
TomThumb

Rick Rothstein \(MVP - VB\)

Vista/Excel 2007 VBA Determine if the Ribbon is minimized?
 
How can I programmatically determine if the Ribbon is minimized or not? I
need something like the imaginary function RibbonMinimized() as Boolean.


You can get the height of the Ribbon this way...

RibbonHeight = CommandBars("Ribbon").Height

and on my system, it is 150 when opened and 59 when minimized; however, I am
sure those numbers are not fixed and vary with display resolution and other
user settings. With that said, it would seem likely that 100 would be
possible test point. I'm thinking of something like this...

If CommandBars("Ribbon").Height < 100 Then
' Ribbon is probably minimized
Else
' Ribbon is probably maximized
End If

Remember... that break point is a **guess** on my part. If I can find
something more substantial, I'll post back.

Rick


TomThumb

Vista/Excel 2007 VBA Determine if the Ribbon is minimized?
 
Thank you, Rick! You really nailed this one.
On my machine I get 55 minimized and 146 maximized.
This is a real help to me, Thanks again
--
TomThumb


"Rick Rothstein (MVP - VB)" wrote:

How can I programmatically determine if the Ribbon is minimized or not? I
need something like the imaginary function RibbonMinimized() as Boolean.


You can get the height of the Ribbon this way...

RibbonHeight = CommandBars("Ribbon").Height

and on my system, it is 150 when opened and 59 when minimized; however, I am
sure those numbers are not fixed and vary with display resolution and other
user settings. With that said, it would seem likely that 100 would be
possible test point. I'm thinking of something like this...

If CommandBars("Ribbon").Height < 100 Then
' Ribbon is probably minimized
Else
' Ribbon is probably maximized
End If

Remember... that break point is a **guess** on my part. If I can find
something more substantial, I'll post back.

Rick




All times are GMT +1. The time now is 02:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com