简体   繁体   English

通过单击 excel 中的宏按钮打开 VBA window

[英]Open VBA window by clicking macro button in excel

I am using excel and learning how to code in vba for macro buttons.我正在使用 excel 并学习如何在 vba 中为宏按钮编写代码。

I was trying to create button and put a code so that when I double click on the button vba window gets open instead of using shortcut alt+f11.我试图创建按钮并输入代码,以便当我双击按钮 vba window 时打开而不是使用快捷键 alt+f11。

Can anyone please provide any details if there is any code?如果有任何代码,任何人都可以提供任何详细信息吗? Thanks谢谢

This will do it:这将做到:

Private Sub CommandButton1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Application.VBE.MainWindow.Visible = True
End Sub

Put this in the sheet object your button is on.把它放在你的按钮打开的表格 object 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM