VBE

  • Thread starter Thread starter Frank Ashley
  • Start date Start date
F

Frank Ashley

Does anybody know how I would close the VBE window programmatically. I can
close the codepanes OK but I want to close the entire VBE.


Thanks
Frank
 
Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Long) As Long


Const WM_SYSCOMMAND = &H112
Const SC_CLOSE = &HF060&


Sub CloseVBEWindow()
Dim lpClassName As String
Dim lpCaption As String
Dim hwnd As Long
lpClassName = "wndclass_desked_gsk"
hwnd = FindWindow(lpClassName, vbNullString)
hwnd = SendMessage(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0&)
End Sub


or simply

Application.VBE.MainWindow.Visible = False


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks for the quick response which works but unfortunately my goalposts
have moved.

rgds
Frank
 
Back
Top