Hello, the video is great!, this video tells how to add right click pop-up menu. Can you pl tell me how to add a right click pop-up menu for a ListBox Item (i.e., each entries in the list box)?
Thank you for the nice and clear video! I tried on Excel 365 but it doesn't compile the VBA Project because it does not find "msocontrolbutton"... It looks like some library is missing. Do you know how to load it?
@@VBAA2Z Not just for Cut/Copy/Paste/Select, this way form specific buttons (e.g. Add, Edit, Save, Delete etc.) can be defined to save space on the form. I guess the popup menu can be made appear on a specific location on the form, isn't it (not on right-click) ?? Possibly private sub/function inside the form can also be triggered by .OnAction=""... right?
Yes you can. example below for menu anywhere in UserForm. Replicate as many items as needed. Private Sub UserForm_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) PopRightClickMenu End Sub More menu examples/sample download here ua-cam.com/video/Cia-EO6KpFA/v-deo.html
Your video's are beyond the thinking. Thanks for sharing all this valuable information with us. Just have one question: Is it possible to automatically adjust the column size in a multi-column listbox based on data that is inserted? I know only the static one. Have search the internet, but couldn't find something which I can understand. I know that the answer is yes, but how to code it. Can you please help me with this. (Suggestion: Maybe a video on this). Many thanks in advance.
Check out this Listbox video:ua-cam.com/video/ZMLIr3UZOEI/v-deo.html There is no AutoFit method, so to get around this would be to scan your data input and use its LEN to set the size. Below is the sample of adding 3 columns with column width. Me.ListBox1.ColumnCount = 3 Me.ListBox1.ColumnWidths = "30,70,70"
Thank you for the quick reply. I wil look forward on the internet. The listview would be a great option if it would work on 64 bit. Thats the issue when you build a excel application which will be used by many people.
ListView works in 64bit Excel. Simply install Common Controls provided in ua-cam.com/video/QGZqjUGhJ1Q/v-deo.html www.microsoft.com/en-us/download/confirmation.aspx?id=10019
Sir it latter work perfectly thank you But when I am calling my macro e g that's onaction = "myname" it's saying that such macro is not available in the work but it's there
Hi This is exactly what I'm looking for but for some reason my "Copy" macro doesn't work (Copy is the only option I want on the menu). The popup menu shows and then goes when clicked but the txtBox contents are not on the clipboard. Code below if anyone can help with where I've gone wrong? Thanks heaps! Option Compare Text Public txtObj As MSForms.TextBox Const menuName As String = "tempMenu" Sub DeleteMenu() On Error Resume Next CommandBars(menuName).Delete On Error GoTo 0 End Sub Sub PopRightClickMenu() DeleteMenu With CommandBars.Add(menuName, msoBarPopup)
With .Controls.Add(msoControlButton) .OnAction = "tbox_copy" .Caption = "Copy" End With .ShowPopup End With DeleteMenu End Sub Private Sub txt_bus_name_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 2 Then Set txtObj = txt_bus_name PopRightClickMenu End If End Sub Private Sub txt_email_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 2 Then Set txtObj = txt_email PopRightClickMenu End If End Sub Private Sub txt_name_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 2 Then Set txtObj = txt_name PopRightClickMenu End If End Sub Private Sub txt_phone_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 2 Then Set txtObj = txt_phone PopRightClickMenu End If End Sub Private Sub UserForm_Initialize() txtBox_search.SetFocus End Sub Private Sub UserForm_Terminate() Set txtObj = Nothing End Sub Public Sub tbox_copy() txtObj.Copy End Sub
Didn't know you can actually add this in user forms. You make it look so easy. Great job!
thanks!
You are doing an exceptional job and your channel is a wealth of knowledge, thank you very much for work.
You are very welcome
very useful.I needed this solution since the latest version of excel do not support the date picker in userform control
thanks
Thanks for another useful tutorial. Will check back later for project
Cool, thanks
Exactly what I need. Good job very clean.
Thanks! 👍
excellent work, many successes in all
Many many thanks
These videos are exceptional. Thank you
Glad you like them! Thanks for watching.
really great job thx 4 this info bro
Glad it helped
Thanks as always. Appreciate sharing your knowledge with us
So nice of you, thanks
Amazing. Very useful to know.
Glad it was helpful!
Thank you Pamai
You are so welcome
Never knew about this. thank you
Glad it was helpful! thanks for watching
Thanks for sharing your knowledge
My pleasure
Hello, the video is great!, this video tells how to add right click pop-up menu. Can you pl tell me how to add a right click pop-up menu for a ListBox Item (i.e., each entries in the list box)?
Let me check
Thank you for the nice and clear video! I tried on Excel 365 but it doesn't compile the VBA Project because it does not find "msocontrolbutton"... It looks like some library is missing. Do you know how to load it?
If it's having trouble with msoControlButton then set a reference to Microsoft Office 16.0 Object Library. your version might be different.
@@VBAA2Z It works!!! Thank you very much!!!
You're most welcome.
عمل رائع
جزاك الله خيرا و انار قلبك
God bless
HI! thanks for the VBA, I have tried it on windows it works perfectly however it does not on Mac, is there anything that I am missing? please help
Sorry I don't have Mac to test this
Thanks sir. It’ll be very useful
Always welcome
Great videos. Thanks
Thanks for watching!
Harika Videolar... Çok Teşekkürler....
Great Videos ... Thank you very much... :)
You're welcome Ahmed. thanks for watching
A very useful one!
Glad it was helpful! thanks for watching
@@VBAA2Z Not just for Cut/Copy/Paste/Select, this way form specific buttons (e.g. Add, Edit, Save, Delete etc.) can be defined to save space on the form. I guess the popup menu can be made appear on a specific location on the form, isn't it (not on right-click) ??
Possibly private sub/function inside the form can also be triggered by .OnAction=""... right?
Yes you can. example below for menu anywhere in UserForm. Replicate as many items as needed.
Private Sub UserForm_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
PopRightClickMenu
End Sub
More menu examples/sample download here
ua-cam.com/video/Cia-EO6KpFA/v-deo.html
thank you so much for the GREAT things!
You are so welcome!
This way we cannot call a "Private Sub" within the UserForm but only Public Subs in regular Code Modules, am I right?
Correct
I try this code to my form but it has error 424 (object required). how to solve it?
You can share your code and point me to the line causing error
Great job, i finished my ui/ux userform with richtextbox to send email without exit to excel, if you wannna see, tell me!
Thanks Zito. Email id is in video description
Your video's are beyond the thinking. Thanks for sharing all this valuable information with us.
Just have one question:
Is it possible to automatically adjust the column size in a multi-column listbox based on data that is inserted? I know only the static one. Have search the internet, but couldn't find something which I can understand. I know that the answer is yes, but how to code it. Can you please help me with this. (Suggestion: Maybe a video on this). Many thanks in advance.
Check out this Listbox video:ua-cam.com/video/ZMLIr3UZOEI/v-deo.html
There is no AutoFit method, so to get around this would be to scan your data input and use its LEN to set the size. Below is the sample of adding 3 columns with column width.
Me.ListBox1.ColumnCount = 3
Me.ListBox1.ColumnWidths = "30,70,70"
try and replicate something like this.
ua-cam.com/video/U1sQ1-Oa0fs/v-deo.html
Thank you for the quick reply. I wil look forward on the internet. The listview would be a great option if it would work on 64 bit. Thats the issue when you build a excel application which will be used by many people.
ListView works in 64bit Excel. Simply install Common Controls provided in
ua-cam.com/video/QGZqjUGhJ1Q/v-deo.html
www.microsoft.com/en-us/download/confirmation.aspx?id=10019
Great job
Thanks!
Brother this is something new I have not seen thankyou for the amazing video, how do I download the right click menu file
You're most welcome. please check link in the description.
Superb
Thank you! Cheers!
Thank you sir
You're welcome! thanks for watching
Thanks a lot
Most welcome
Hello sir, I try such but it's showing Run time error 5
Invalid procedure call or argument
where (which module and procedure name) are you facing this error?
@@VBAA2Z in
With commandbars.add (msocontrolbutton)
Sir it latter work perfectly thank you
But when I am calling my macro e g that's onaction = "myname" it's saying that such macro is not available in the work but it's there
Everything works, except of the PopupMenu istn't vanishing after a selection. Wrote the exact same code as you....
Check the object click sub routine
Cool 😎
Cool 😎😎
thanks
You're welcome!
Thanks for amazing contents.
Please share tips to automate VBA undo / Ctrl Z
Will upload soon - thanks for your suggestion and visit.
Thanks
Welcome
Hi
This is exactly what I'm looking for but for some reason my "Copy" macro doesn't work (Copy is the only option I want on the menu).
The popup menu shows and then goes when clicked but the txtBox contents are not on the clipboard.
Code below if anyone can help with where I've gone wrong?
Thanks heaps!
Option Compare Text
Public txtObj As MSForms.TextBox
Const menuName As String = "tempMenu"
Sub DeleteMenu()
On Error Resume Next
CommandBars(menuName).Delete
On Error GoTo 0
End Sub
Sub PopRightClickMenu()
DeleteMenu
With CommandBars.Add(menuName, msoBarPopup)
With .Controls.Add(msoControlButton)
.OnAction = "tbox_copy"
.Caption = "Copy"
End With
.ShowPopup
End With
DeleteMenu
End Sub
Private Sub txt_bus_name_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
Set txtObj = txt_bus_name
PopRightClickMenu
End If
End Sub
Private Sub txt_email_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
Set txtObj = txt_email
PopRightClickMenu
End If
End Sub
Private Sub txt_name_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
Set txtObj = txt_name
PopRightClickMenu
End If
End Sub
Private Sub txt_phone_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
Set txtObj = txt_phone
PopRightClickMenu
End If
End Sub
Private Sub UserForm_Initialize()
txtBox_search.SetFocus
End Sub
Private Sub UserForm_Terminate()
Set txtObj = Nothing
End Sub
Public Sub tbox_copy()
txtObj.Copy
End Sub
code looks fine. any error message?
THANKS
You're welcome!