ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert into the Worksheet Menu Bar (https://www.excelbanter.com/excel-programming/433490-insert-into-worksheet-menu-bar.html)

Dirk[_5_]

Insert into the Worksheet Menu Bar
 
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.

Gord Dibben

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.



Dirk[_5_]

Insert into the Worksheet Menu Bar
 
Thanks for the help. I do appreciate it.


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com