Results 1 to 20 of 117

Thread: Challenge!! Can you solve this problem?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #28
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Quote Originally Posted by Tommy
    As I posted earlier this may be MS's way of preventing the spread of viruses. I do know that in Excel you cannot add a macro to a newly created sheet (via a macro/code) until it is saved, as MD as suggested, and johnske has suggested it is the same for Word.....(etc)
    Indeed tommy, if one plays around with the following subs you will see that once the VBE window is opened (state 2 as far as I'm aware), you can exit from the VBE window, run the macro "IsVBEWindowOpen" and find that it's still open....It remains open (though certainly not visible) until after you completely QUIT (not just save) the application.

    Sub OpenVBEwindow_ByVisible()
        Application.VBE.MainWindow.Visible = True
    End Sub
     
    Sub OpenVBEwindow_ByState()
        Application.VBE.MainWindow.WindowState = 2
    End Sub
     
    Sub IsVBEwindowOpen()
        If Application.VBE.MainWindow.WindowState = 2 Then MsgBox "VBE window is open (State 2)"
    End Sub
    Last edited by Aussiebear; 05-07-2025 at 04:05 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •