Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i have written a little code to add some new items to the "cells" right
click menu. the only way i could figure out to use a right click menu was to call a second sub that opens the userform. here's what i am doing now: With Application.CommandBars("Cell").Controls With .Add(temporary:=True) .Caption = "Respond" .OnAction = "module1.ShowForm" .Tag = cControlTag End With |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
natanz wrote:
Sub ShowForm(FormName As UserForm) FormName.Show End Sub but that doesn't work. Can anyone help? The funny thing is that your userform1 doesn't inherit from UserForm type and UserForm itself doesn't have Show method :) Sub ShowForm(FormName As Object) should work. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kris had a good idea, but unfortunately it won't work.
Here is a tested solution that does work: Sub ABCD() cControlTag = "ABC" With Application.CommandBars("Cell").Controls With .Add(temporary:=True) .Caption = "Log New RFI(s)" .OnAction = "'ShowForm ""LogInNew""'" 'This is crazy syntax but this is what it takes to call a sub with 'arguments using .onAction .Tag = cControlTag .BeginGroup = True End With End With End Sub Sub ShowForm(s As String) VBA.UserForms.Add(s).Show End Sub -- Regards, Tom Ogilvy "Kris" wrote in message ... natanz wrote: Sub ShowForm(FormName As UserForm) FormName.Show End Sub but that doesn't work. Can anyone help? The funny thing is that your userform1 doesn't inherit from UserForm type and UserForm itself doesn't have Show method :) Sub ShowForm(FormName As Object) should work. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks for that. I had actually come up with the second solution
already and was about to post it for the edification of all. Unfortunately, i don't really understand it, but i do know it works. that just makes it harder to remember every time i come up against the same problem. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Right click menu | Excel Programming | |||
Adding a menu item right click menu when clicking on a single. | Excel Programming | |||
Adding menu to the mouse right click pop-up menu | Excel Programming | |||
pls help: short cut menu doesn't show when right click mouse | Excel Programming | |||
short cut menu doesn't show when right click on mouse | Excel Programming |