to call procedure in a worksheet in a module
Try:
Call Sheet1.cb_print_click
Change "sheet1" to the codename for the worksheet that contains the
commandbutton.
And change
Private Sub CommandButton1_Click()
to
Sub CommandButton1_Click()
(remove the word Private)
====
You may want to consider moving the code that does the printing to a general
module.
Then your code for the commandbutton would look like:
Option Explicit
Sub CommandButton1_Click()
Call PrintRoutineNameHere
End Sub
And your code in the general module could call that same routine (that's located
in that General module)
CAPTGNVR wrote:
DEAR ALL
I have a command button to which i hv written code to pritn the
report. (for ex: cb_print_click) which resides under excell objects.
In another module I have also written a procedure for updating the
report which resides in the modules. In this module i want to call the
procedure ' cb_print_click' which is in the worksheet, so that it
will lead to the printing part of the code. Pls sugest.
--
Dave Peterson
|