Formula Bar Shortcut Meny Insert

P

Pete

I've got a question about a menu item I've added to the "Formula Bar"
shortcut menu. I'm trying to insert a predefined text string in the cell
when the user clicks the menu item. However, it doesn't seem that while
you're editing a formula that Excel can run any macros, so I was wondering
if anyone had any idea how to do this.

This is the code I'm trying to use:

Sub InsertPN()
strQ = Chr(34)
ActiveCell.Value = ActiveCell.Value & "$PRP:" & strQ & "DwgNo" & strQ
End Sub

And this is the code I used to create the shortcut menu item:

Sub Menu()
Set FormulaItem = CommandBars("Formula Bar").Controls.Add
With FormulaItem
.Caption = "Insert P/N"
.OnAction = "InsertPN"
.BeginGroup = True
End With
End Sub

TIA for any help.

-Pete
 
G

Guest

Your correct. For any practical purpose, macros don't execute when your are
in edit mode.

Perhaps click the menu item before you go into edit mode.
 

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