View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Insert into the Worksheet Menu Bar

Sub addit()
Set subitem = Application.CommandBars("File") _
..Controls.Add(Type:=msoControlButton, befo=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

On Fri, 11 Sep 2009 12:18:37 -0700 (PDT), Dirk wrote:

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.