PC Review


Reply
Thread Tools Rate Thread

Context sensitive menu options

 
 
K_Macd
Guest
Posts: n/a
 
      9th Jul 2009

The following code adds another paste special option to the right click menu

With Application.CommandBars("Cell").Controls _
.Add(Type:=msoControlButton, before:=5, _
Temporary:=False)
.Caption = "Paste &Value" '
.OnAction = "PasteSpecValue"
.Tag = "PS_PasteValue"
.Enabled = True

End With

Is there a code action to enable or disable that option dynamically as the
clipboard status alternates between filled and empty rather than test in the
'onaction' procedure at a lower level ?

TIA

--
Ken
"Started using Visicalc in 82"
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jul 2009

You can use the SheetBeforeRightClick event to check whether the clipboard
object is empty or not. If empty disable the option as below..

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
If <object> is nothing then
Application.CommandBars("cell").Controls("controlname").Enabled = False
End If
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"K_Macd" wrote:

> The following code adds another paste special option to the right click menu
>
> With Application.CommandBars("Cell").Controls _
> .Add(Type:=msoControlButton, before:=5, _
> Temporary:=False)
> .Caption = "Paste &Value" '
> .OnAction = "PasteSpecValue"
> .Tag = "PS_PasteValue"
> .Enabled = True
>
> End With
>
> Is there a code action to enable or disable that option dynamically as the
> clipboard status alternates between filled and empty rather than test in the
> 'onaction' procedure at a lower level ?
>
> TIA
>
> --
> Ken
> "Started using Visicalc in 82"

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Context-sensitive custom menu item. Murray Microsoft Excel Programming 7 28th Dec 2005 04:55 AM
No context sensitive drop down menu - help needed. Chris Mitchell Microsoft Outlook 0 13th Mar 2004 05:37 AM
Context sensitive menu - confused. Chris Mitchell Microsoft Outlook 3 6th Mar 2004 11:55 AM
Context sensitive menu Mark Microsoft Excel Programming 5 3rd Mar 2004 01:50 PM
Context menus and treeviews, suggestions for a NODE sensitive context menu Eric Newton Microsoft Dot NET Framework Forms 4 13th Jan 2004 09:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:29 PM.