ostergloekchen
ostergloekchen

Reputation: 13

Open VBA window with macro

I'm currently working on a vba tool in excel with its own UI. Usualy I don't need the VBA window while using it.

But sometimes I want to open the VBA window to make some changes without closing the UI (Alt + F11 doesn't work at that point). So I'm thinking about a button that opens the VBA window. Is there any command that opens it?

Thanks in advance!

Upvotes: 1

Views: 1820

Answers (1)

Gary's Student
Gary's Student

Reputation: 96753

Here is something I use all the time.

This code has been "tuned" for the size of my laptop screen. Running it gets both the VBE window and the application window open side-by-side:

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

Upvotes: 2

Related Questions