ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing VBA editior programmatically (https://www.excelbanter.com/excel-programming/289362-closing-vba-editior-programmatically.html)

Shatin

Closing VBA editior programmatically
 
I have a macro which ends like this:

With ActiveWorkbook.VBProject.VBComponents("ThisWorkboo k").CodeModule
StartLine = .CreateEventProc("BeforeClose", "Workbook") + 1
.InsertLines StartLine, _
"Msgbox ""Blahblahblahblah...."",vbOkOnly"
End With

When I run the macro, it does whatever it has to do and then ends by
displaying the code module window with the above code. This will
puzzle my friends who will run the macro since they don't know a thing
about VBA. How can I close the VBA editor programmatically?

Thanks in advance!

BrianB

Closing VBA editior programmatically
 
SendKeys "%{F4}", Tru

--
Message posted from http://www.ExcelForum.com


Shatin

Closing VBA editior programmatically
 
I see. Pretty clever!

BrianB wrote in message ...
SendKeys "%{F4}", True


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com