Calling sub routines
You can put the Print_Report code in a general module
You should probably alter it to receive a reference to the form calling it
as an argument
then it can pick up the values it needs from the form
UserForm1
Private Sub CmdPrint_Click()
Print_Report Me
End Sub
---------------------------
UserForm2
Private Sub CmdPrint_Click()
Print_Report Me
End Sub
---------------------------
General module
Public Sub Print_Report(form)
MsgBox form.Label1.Caption
End Sub
--
Regards,
Tom Ogilvy
"Andrew" wrote in message
...
I have a userform with a sub-routine "under" it that I want to call from a
routine under another userform within the same project. I changed the
called routine title from Sub to Public Sub having read some of the previous
posts on a similar topic but I seem to be missing the plot somewhere.
UserForm1
Private Sub cmdPrint_Click()
Call Print_Report
Public Sub Print_Report()
...... this works
UserForm2
Private Sub cmdPrint_Click()
Call Print_Report
...... this doesn't work
I cant put the Print_Report() routine in the Modules section because it
pulls values from the forms. I guess there is a way to get over that
problem as well but I thought the first fix would be the easiest to discuss.
Thanks for your help in advance.
Andrew
|