Insert into the Worksheet Menu Bar

D

Dirk

I have a macro that will allow my users to export particular colomns
of a worksheet to a tab delimited file and I would like to insert a
"Save as Text" option in the "File" menu just after the "Save as..."
action. I was able to create a new menu option and add my macro to
that but I am stuck on how to insert it in the "File". I have tried
with the recorder but that did not work.

Any help will be appreciated.
 
G

Gord Dibben

Sub addit()
Set subitem = Application.CommandBars("File") _
..Controls.Add(Type:=msoControlButton, before:=6)
subitem.Caption = "Save As Text"
subitem.OnAction = "themacro"
End Sub

Sub removeit()
Application.CommandBars("File").Controls("Save As Text").Delete
End Sub

These can be called on workbook_open and BeforeClose

Or Activate and Deactivate


Gord Dibben MS Excel MVP
 

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