Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default right click menu, userform show

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default right click menu, userform show

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default right click menu, userform show

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default right click menu, userform show

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Right click menu Mats.Bergstrand Excel Programming 0 December 17th 05 10:33 AM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 PM
Adding menu to the mouse right click pop-up menu Jack Excel Programming 1 February 12th 04 05:23 AM
pls help: short cut menu doesn't show when right click mouse Yong Wah Excel Programming 1 October 23rd 03 01:56 PM
short cut menu doesn't show when right click on mouse Yong Wah Excel Programming 2 October 21st 03 01:42 PM


All times are GMT +1. The time now is 11:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"