Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Visual Basic Editor 1

Status
Not open for further replies.

lmontes

Programmer
Jan 28, 2002
25
US
How can I close the VBE using VBA
 
Set a reference to the "Microsoft Visual Basic for Applications Extensibility 5.3" libary so you can code using the VBE, and use a macro to call a function like this:
Code:
Function CloseVBE()
On Error Resume Next
  Dim editor As VBE
  Set editor = Application.VBE
  editor.MainWindow.SetFocus
  SendKeys "%{F4}"
End Function
You can code [tt]editor.MainWindow.Close[/tt] but it will trigger an error. Using SendKeys simulates the user shutting down the window.

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top