Reputation: 75
I find this code on site.
Private Sub Workbook_Open()
UserForm1.Show
End Sub
It's not working.
I want to open «Visual Basic» after starting Excel then open the window Module1
for example. Is it feasible?
Upvotes: 0
Views: 142
Reputation:
Note that Private Sub Workbook_Open() should be located in ThisWorkbook, not in a module, if so, then it's not being called.
Upvotes: 1
Reputation: 3248
To open the Virtual Basic Editor (VBE) on a specific module, try the following
Private Sub Workbook_Open()
Application.VBE.MainWindow.Visible = True
Me.VBProject.VBComponents("Module1").Activate
End Sub
Upvotes: 2
Reputation: 738
Alternative to @TimStack:
(althought I do prefer his Method)
Private Sub Workbook_Open()
SendKeys "%{F11}"
End Sub
Upvotes: 0