Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Formula Bar Shortcut Meny Insert

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Formula Bar Shortcut Meny Insert

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you insert a shortcut to a different workbook? Sheila Excel Worksheet Functions 1 November 10th 09 07:01 PM
how can i use form/skjema tool for meny list spred in dif arks NachOslo Excel Worksheet Functions 0 July 2nd 09 01:57 PM
what is the shortcut to insert a new row in excel?? r a s . . Excel Discussion (Misc queries) 4 July 22nd 06 12:24 AM
Keyboard shortcut to auto insert $ sign into formula? Zakynthos Excel Programming 4 September 7th 05 11:37 AM
Shortcut Key to insert an em-dash? Fred Holmes Excel Programming 1 May 23rd 05 06:43 PM


All times are GMT +1. The time now is 05:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"