Opening the VB Editor via VB

R

Rivers

Guys ive created a custom toolbar and to save time doing it again at work ive
created my toolbar using VB macro. simple enough! however theres a few
options i cant find how to code.

the first is the vb editor. i know i can press alt f11 or simply add the
command via the customiser but how do i call it via vb?

the second is the macro box where you select the macro you require from the
list box.

can anyone help?

Rivers
 
J

JLGWhiz

Application.VBE.MainWindow.Visible = True

Application.Dialogs(xlDialogMacroOptions).Show
 
R

Rivers

hi thanks for the quick response but they do not work

the
Application.VBE.MainWindow.Visible = True
gives a warning of it cannot be trusted

end the
Application.Dialogs(xlDialogMacroOptions).Show
and this gives a warning of dialogue class failed

am i entering these in incorrectly

thanks again
rivers
 
J

JLGWhiz

If your security setting is at medium you might get the message that it can't
be trusted, but it came right out of the VBA help file, so it is probably
just following the security protocol to warn you.

I cannot find any info on the MacroOptions dialog box, but it also is in the
VBA help files and should work unless Microsoft disabled it for some reason.
I could not get it to work either and like I said, nothing in the knowledge
base about it under that name. There is a MacroOptions method, but I don't
believe that would help you. You might look into using send keys to open the
dialog box for macros.
 
S

ShaneDevenshire

Hi,

I believe the Application.Dialogs(xlDialogMacroOptions).Show
command has a number of arguments that are needed because this isn't the
Macros dialog box but the Options dialog box that displays when you click the
Optins button when you are in the Macros dialog box.
 
J

JLGWhiz

I think my other message got lost in cyberspace. You are right, Shane.
After a lot of reading and research I had come to that conclusion. It is one
of the methods that I have never used and I was guessing at what it did. I
also found that the SendKeys:

Application.SendKeys "%{F8}"

Does not work either. It simply activates the menu bar, although manually
Alt + F8 will open the dialog box for macros. Send Keys is another one that
I rarely use, so I could be screwing it up. I don't know if it requires
Shell every time it runs or not.
I try to stay away from all those frilly things when I plan a project and
just use good ole VBA code syntax and methods.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top