Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default shortcut for menu

HI,
in the following code I create a custom menu but I would
like to have the shortcut to be set for the button and
written in the menu. I can't find where to put them ?
Can someone advise, thanks a lot


Dim cbar As Office.CommandBar
Dim monoutil As CommandBarControl
Dim menu1, cbctl1, cbctl2, cbctl3, cbctl4 As
CommandBarControl
Dim sub1, sub2, sub3 As CommandBarButton

'create a control popup on the main Worksheet menu bar
Set monoutil = Application.CommandBars("worksheet menu
bar").Controls.Add(Type:=msoControlPopup)
monoutil.Caption = "&Sbops-Tool 1.0"
monoutil.Visible = True

'add a menu item
Set cbctl1 = monoutil.Controls.Add(Type:=msoControlButton)
With cbctl1
.Visible = True
.Style = msoButtonIconAndCaption
.Caption = "Create an import File" ' is required
for caption
.OnAction = ThisWorkbook.Name & "!
outils.importfile" 'action to perform
.FaceId = 2670
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default shortcut for menu

Douvid,

I don't think the control's property that shows the shortcut is exposed to VBA.

But you could simply change your caption to include the shortcut:

..Caption = "Create an import File Ctrl-P"

HTH,
Bernie
Excel MVP


"Douvid" wrote in message ...
and where do I have to declare it ?
It still doesn't appear in the menu ?
But I'm getting close
Cheers,
Douvid


-----Original Message-----
Douvid,


If by shortcut you mean a CTRL+key combination, then

Application.MacroOptions _
Macro:= ThisWorkbook.Name & "!outils.importfile",

_
ShortcutKey:="p"

for example.

HTH,
Bernie
Excel MVP


"Douvid" wrote in message

...
HI,
in the following code I create a custom menu but I would
like to have the shortcut to be set for the button and
written in the menu. I can't find where to put them ?
Can someone advise, thanks a lot


Dim cbar As Office.CommandBar
Dim monoutil As CommandBarControl
Dim menu1, cbctl1, cbctl2, cbctl3, cbctl4 As
CommandBarControl
Dim sub1, sub2, sub3 As CommandBarButton

'create a control popup on the main Worksheet menu bar
Set monoutil = Application.CommandBars("worksheet menu
bar").Controls.Add(Type:=msoControlPopup)
monoutil.Caption = "&Sbops-Tool 1.0"
monoutil.Visible = True

'add a menu item
Set cbctl1 = monoutil.Controls.Add

(Type:=msoControlButton)
With cbctl1
.Visible = True
.Style = msoButtonIconAndCaption
.Caption = "Create an import File" ' is required
for caption
.OnAction = ThisWorkbook.Name & "!
outils.importfile" 'action to perform
.FaceId = 2670
End With



.



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
Worksheet Shortcut Menu PosseJohn Excel Discussion (Misc queries) 2 February 1st 10 10:14 PM
What is a shortcut menu? Jeffry Excel Discussion (Misc queries) 4 May 4th 09 04:03 PM
Popup Menu / Shortcut Menu Dale Fye Excel Discussion (Misc queries) 2 October 12th 07 12:57 AM
Alt Shortcut from right-click menu JB2010 Excel Discussion (Misc queries) 1 July 26th 07 05:08 PM
shortcut menu Javed Excel Discussion (Misc queries) 1 December 6th 04 09:28 PM


All times are GMT +1. The time now is 09:32 PM.

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

About Us

"It's about Microsoft Excel"