Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. -- Regards, Tom Ogilvy "Pete" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can you insert a shortcut to a different workbook? | Excel Worksheet Functions | |||
how can i use form/skjema tool for meny list spred in dif arks | Excel Worksheet Functions | |||
what is the shortcut to insert a new row in excel?? | Excel Discussion (Misc queries) | |||
Keyboard shortcut to auto insert $ sign into formula? | Excel Programming | |||
Shortcut Key to insert an em-dash? | Excel Programming |