VBA最小化Excel中的功能区 [英] VBA minimize ribbon in Excel

查看:1275
本文介绍了VBA最小化Excel中的功能区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Excel 2013中使用VBA最小化功能区。我不想切换功能区,我不想隐藏包括文件,插入等的所有内容。我已经尝试了几种不同的方法,但没有一个满足我想要的。



这隐藏了一切:

  Application.ExecuteExcel4MacroShow.ToolBar (Ribbon,False)

这个切换:

  CommandBars.ExecuteMsoMinimizeRibbon

这也切换:

  SendKeys^ {F1}

如何强制我的功能区被最小化?

解决方案

不确定你什么时候打电话给这个,但是如果打开的话,这个工作可以最小化功能区。

 如果Application.CommandBars(功能)高度> = 150然后
SendKeys^ {F1}
如果
$ / code $ <$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $

打开功能区最小尺寸似乎是150,所以这只会切换,如果它是打开的


I want to minimize the ribbon in Excel 2013 with VBA. I do not want to toggle the ribbon, and I do not want to hide everything including "File", "Insert", etc. I have tried several different methods, but none satisfy what I want.

This hides everything:

Application.ExecuteExcel4Macro "Show.ToolBar(""Ribbon"",False)

This toggles:

CommandBars.ExecuteMso "MinimizeRibbon"

This also toggles:

SendKeys "^{F1}"

How can I simply force my ribbon to be minimized?

解决方案

Not sure when you are trying to call this but this will work to minimize the ribbon if its open

If Application.CommandBars("Ribbon").Height >= 150 Then
    SendKeys "^{F1}"
End If

Open Ribbon minimum size seems to be 150 so this will only toggle if it's open

这篇关于VBA最小化Excel中的功能区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆