Keep VBA window hidden
JGeniti wrote:
Hi guys.
I'm trying to add an event procedure to my VBA code and I am unable to
supress the VBA window from opening when the macro runs.
I have tried turning off screen updating and making sure that the VBA
window is closed but it still opens when it runs.
Any help would be appreciated.
Thanks
James
Application.ScreenUpdating = False
Application.VBE.MainWindow.Visible = False
With ActiveWorkbook.VBProject.VBComponents("Sheet7").Co deModule
StartLine = .CreateEventProc("BeforeDoubleClick", "Worksheet") + 1
.InsertLines StartLine, "PurchasePartsDblClick"
End With
Sceen updating works only on Excel windows.
You can't hide VBE windows, but you can freeze it.
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock
As Long) As Long
ActiveWorkbook.VBProject.VBE.MainWindow.SetFocus
LockWindowUpdate Application.VBE.MainWindow.Hwnd
your code
Application.VBE.MainWindow.Visible = False
LockWindowUpdate 0&
|