ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Menu (https://www.excelbanter.com/excel-programming/398499-custom-menu.html)

Mike H.

Custom Menu
 
I have this code on a custom menu option:
With CustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Process This Labor Summary"
.OnAction = UserForm2.Show
End With

And this code on activation:
Private Sub UserForm_activate()
Call PRProc
End Sub

But this does not work. How do I have a menu option load a form which then
calls a process?

Gary''s Student

Custom Menu
 
First try:

Private Sub UserForm_activate()
MsgBox ("Hi Mike")
End Sub

just to make sure the button is connected to the handling sub.
Then, with your original code, make su
PRProc
has been declared in a nice Public fashion.
--
Gary''s Student - gsnu200748


"Mike H." wrote:

I have this code on a custom menu option:
With CustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Process This Labor Summary"
.OnAction = UserForm2.Show
End With

And this code on activation:
Private Sub UserForm_activate()
Call PRProc
End Sub

But this does not work. How do I have a menu option load a form which then
calls a process?


Mike H.

Custom Menu
 
I am not using a button. I am using a pull-down custom menu option. And the
function is public.

Basically the work-around would be if I knew how to load a form but not make
it Modal (linger on the screen and stop code execution) if I just issue the
command
UserForm2.Show
Is this possible? Then I would just have the menu call the sub and the sub
would load the form and continue on. This form is a progress bar and I want
to continually update it during the execution of the rest of the code in the
sub.

JRForm

Custom Menu
 
Mike H,

Try this

UserForm2.show will call up the form in modal mopde i.e. the form has the
focus and user cannot click else where until the form is dismissed.

In the UserForm2 code module put in your call for the other proceedure

Private Sub UserForm_Initialize()
Call PRproc
End Sub

"Mike H." wrote:

I am not using a button. I am using a pull-down custom menu option. And the
function is public.

Basically the work-around would be if I knew how to load a form but not make
it Modal (linger on the screen and stop code execution) if I just issue the
command
UserForm2.Show
Is this possible? Then I would just have the menu call the sub and the sub
would load the form and continue on. This form is a progress bar and I want
to continually update it during the execution of the rest of the code in the
sub.



All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com