Il ne semblepas y avoir de m/thodes intégrée présentant la possibilité de fermer l'éditeur VBE sous Access 2000. Une alternative consiste à fermer la fenêtre une fois repérée par son titre.
Le code qui suit implémente cette idée.
Private Const WM_CLOSE = &H10
Private Declare Function apiPostMessage _
Lib "user32" Alias "PostMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) _
As Long
Private Declare Function apiFindWindow _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
Private Declare Function apiIsWindow _
Lib "user32" Alias "IsWindow" _
(ByVal hwnd As Long) _
As Long
Function fCloseVBEWindow() As Boolean
' Closes the VBE window if it's currently open
'
Const VBE_CLASS = "wndclass_desked_gsk"
Dim hwnd As Long
hwnd = apiFindWindow(VBE_CLASS, VBE.MainWindow.Caption)
If hwnd Then
Call apiPostMessage( _
hwnd, _
WM_CLOSE, _
0, _
ByVal 0&)
fCloseVBEWindow = (apiIsWindow(hwnd) <> 0)
End If
End Function