|
Friday, September 25, 2009 - 1:43 PM
This is useful for hiding the VBE after code stops (do to a "Stop" statement, because the user interrupted the code, or because of an error).
Public gvTestVBEAccess As Boolean
Public Function HideVBE() On Error Resume Next If fTestVBEAccess Then Application.VBE.MainWindow.Visible = False End Function
Private Function fTestVBEAccess() As Boolean 'returns true if the project isn't locked 'uses gvTestVBEAccess public boolean for sake of speed If gvTestVBEAccess Then fTestVBEAccess = True: Exit Function On Error Resume Next Dim vbp As VBProject: Set vbp = ThisWorkbook.VBProject If (vbp.Protection <> vbext_pp_locked) Then gvTestVBEAccess = True: fTestVBEAccess = True End Function
Example usage: Stop: HideVBE
|
|
| << Navigate to Friday, September 25, 2009 |
Add New Comment |