用宏打开VBA窗口

时间:2016-05-26 12:46:35

标签: excel vba editor

我目前正在使用自己的用户界面开发excel中的vba工具。 Usualy我在使用它时不需要VBA窗口。

但有时我想打开VBA窗口进行一些更改而不关闭UI(此时Alt + F11不起作用)。所以我正在考虑一个打开VBA窗口的按钮。有没有打开它的命令?

提前致谢!

1 个答案:

答案 0 :(得分:2)

这是我一直使用的东西。

此代码已经过"调整"对于我的笔记本电脑屏幕的大小。运行它得到两者 VBE窗口和应用程序窗口并排打开:

Sub dual()
    Dim h As Long
    With Application
        .WindowState = xlMaximized
        x = Application.ActiveWindow.Width \ 2
        h = Application.ActiveWindow.Height
        .WindowState = xlNormal
        .Left = 545
        .Height = 550
        .Width = x * 0.9
        .Top = 0
        With .VBE.MainWindow
            .Width = 1.4 * x
            .Left = 0
            .Top = 0
            .Height = 740
            .WindowState = vbext_ws_Normal
        End With
    End With
End Sub