VB icon

Add Commands to Menus in VB (AddIn Creator)

Email
Submitted on: 1/9/2015 4:36:00 AM
By: VbNick (from psc cd)  
Level: Advanced
User Rating: By 4 Users
Compatibility: VB 5.0, VB 6.0
Views: 736
 
     Hey, you always have seen some people adding some cool addin to VB which esase their programming right? now you can do it too...You can add commands, command buttons, to menus with any command you like...
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Add Commands to Menus in VB (AddIn Creator)
' Description:Hey, you always have seen some people adding some cool addin to VB which esase their programming right? now you can do it too...You can add commands, command buttons, to menus with any command you like...
' By: VbNick (from psc cd)
'**************************************

' by Kayhan TanrisevenThe Benchmarker®
' 
' Example code of to add menu items to VB's popup Menus
'
' If needed, I will post a sample zipped project also..
' for this reason, please feedback..
' create all the user interface items
On Error GoTo CreateMenuItems_Error
' create the menu items in the code window and code break window
With VBInstance.CommandBars("Code Window").Controls
	Set MenuItem1 = .Add(msoControlButton)
	MenuItem1.Caption = "&Append To Clipboard"
	MenuItem1.BeginGroup = True
	Set MenuHandler1 = 	VBInstance.Events.CommandBarEvents(MenuItem1)
	Set MenuItem2 = .Add(msoControlButton)
	MenuItem2.Caption = "Clipboard &History"
	Set MenuHandler2 = 	VBInstance.Events.CommandBarEvents(MenuItem2)
End With 
With VBInstance.CommandBars("Code Window (Break)").Controls
	Set MenuItem3 = .Add(msoControlButton)
	MenuItem1.Caption = "&Append To Clipboard"
	MenuItem1.BeginGroup = True
	Set MenuHandler3 = 	VBInstance.Events.CommandBarEvents(MenuItem3)
	Set MenuItem4 = .Add(msoControlButton)
	MenuItem4.Caption = "Clipboard &History"
	Set MenuHandler4 = 	VBInstance.Events.CommandBarEvents(MenuItem4)
End With
Exit Sub 
CreateMenuItems_Error:
MsgBox "Unable To create necessary menu items", vbCritical


Other 9 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.