VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Add Commands to Menus in VB (AddIn Creator)

by VbNick (10 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 3.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

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...

Rate Add Commands to Menus in VB (AddIn Creator)

' by Kayhan Tanriseven  The 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

Download this snippet    Add to My Saved Code

Add Commands to Menus in VB (AddIn Creator) Comments

No comments have been posted about Add Commands to Menus in VB (AddIn Creator). Why not be the first to post a comment about Add Commands to Menus in VB (AddIn Creator).

Post your comment

Subject:
Message:
0/1000 characters