user-defined type not defined - Command Bar Control

mond007

New Member
Joined
Oct 9, 2008
Messages
34
Hi <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
I am trying to capture with Worksheet Change a command bar action like paste but I am getting an error : <o:p></o:p>
<o:p> </o:p>
“User-Defined type not defined”<o:p></o:p>
<o:p> </o:p>
Do I need a library of sort in References ??<o:p></o:p>
<o:p> </o:p>
Code:
[FONT=Courier New]Public Sub Right_Click()<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p> </o:p>[/FONT]
[FONT=Courier New]Dim oControl As CommandBarControl<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p> </o:p>[/FONT]
[FONT=Courier New]For Each oControl In CommandBars("Cell").Controls<o:p></o:p>[/FONT]
[FONT=Courier New]    Debug.Print oControl.Caption<o:p></o:p>[/FONT]
[FONT=Courier New]    If oControl.Caption = "&Paste" Then<o:p></o:p>[/FONT]
[FONT=Courier New]        oControl.OnAction = "MyPaste"<o:p></o:p>[/FONT]
[FONT=Courier New]    End If<o:p></o:p>[/FONT]
[FONT=Courier New]Next oControl<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p> </o:p>[/FONT]
[FONT=Courier New]End Sub<o:p></o:p>[/FONT]
[FONT=Courier New]<o:p></o:p>[/FONT]

Thanks in Advance Kuldip.<o:p></o:p>
 
Opps don't worry it was a red herring.... its was something in WorkSheet_Change causing that Control Z Problem.

Cheers Kuldip
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,214,940
Messages
6,122,361
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top