Macro to call Visual Basic Editor?

ArthurReyes

Board Regular
Joined
Dec 9, 2002
Messages
77
I have a custom admin button on my toolbar. .OnAction is set to "AdminMode"

I want the AdminMode() Sub to open the Visual Basic Editor.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try: -

Public Sub AdminMode()

Application.VBE.CodePanes(1).Show

End Sub
This message was edited by Mudface on 2002-12-10 15:24
 
Upvote 0
Sorry, this should work OK: -
<pre>
Public Sub AdminMode()

Application.VBE.MainWindow.Visible = True

End Sub
</pre>
 
Upvote 0
This worked better, thanks for the lead:

Application.VBE.ActiveVBProject.VBComponents(4).CodeModule.CodePane.Show
 
Upvote 0
. . .because it takes me to the exact module I'm interested in. . .<sorry for the stupid double post>
This message was edited by ArthurReyes on 2002-12-10 15:49
 
Upvote 0
Thanks to all for helping with this, and especially to Maurizio.

Being able to open a particular macro directly by "Go(ing)To" its name is brilliant, and was unknown to me before I found this.

(Before anyone mentions that this thread is nearly 20 years old, I always wonder why people make that kind of comment. So long as applications work the same as they did years ago, people will continue to stumble across the same problems, and ask the same questions about them, and be glad of finding the same answers.)
 
Upvote 0
Another thanks to Maurizio for the exciting macro statement.
I sooo agree with PatrickOfLondon. ...That forum-shared code tends to work 20 years later is a big strength of VBA.
 
Upvote 0

Forum statistics

Threads
1,224,833
Messages
6,181,237
Members
453,026
Latest member
cknader

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top