Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 115
Default to call procedure in a worksheet in a module

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.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 115
Default to call procedure in a worksheet in a module

WOW it was very quick--thnks. I tried and it gives error saying need
object

Call PAWY_INPUT.CBGROUP_Click

PAWY_INPUT IS THE SHEET NAME and CBGROUP_CLICK is the code in that
sheet. I was trying with exclamation after sheet name also and does
not work.



On Jan 31, 2:14 am, Dave Peterson wrote:
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


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default to call procedure in a worksheet in a module

My bet is that the worksheet name is PAW_INPUT. But that's not the codename of
the worksheet.

Open the VBE.
Hit ctrl-r to see the project explorer.
Expand all the objects under your project.

You'll see things like:
Sheet1(PAW_INPUT)

The Sheet1 is the codename. PAW_Input is the name the users see on the
worksheet tab in excel.



CAPTGNVR wrote:

WOW it was very quick--thnks. I tried and it gives error saying need
object

Call PAWY_INPUT.CBGROUP_Click

PAWY_INPUT IS THE SHEET NAME and CBGROUP_CLICK is the code in that
sheet. I was trying with exclamation after sheet name also and does
not work.

On Jan 31, 2:14 am, Dave Peterson wrote:
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


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 115
Default to call procedure in a worksheet in a module

Dear Dave
Before I could read ur recent one-- i tried by the sheet itself as u
mentioned in ur first post. YESSSSSSSS. It worked. Thanks. I can
close another thread. I was using the sheet names instead of codename
of the sheet. Your gidance gave me a clear picture and understanding
of how to go about it.




On Jan 31, 3:53 am, Dave Peterson wrote:
My bet is that the worksheet name is PAW_INPUT. But that's not the codename of
the worksheet.

Open the VBE.
Hit ctrl-r to see the project explorer.
Expand all the objects under your project.

You'll see things like:
Sheet1(PAW_INPUT)

The Sheet1 is the codename. PAW_Input is the name the users see on the
worksheet tab in excel.



CAPTGNVR wrote:

WOW it was very quick--thnks. I tried and it gives error saying need
object


Call PAWY_INPUT.CBGROUP_Click


PAWY_INPUT IS THE SHEET NAME and CBGROUP_CLICK is the code in that
sheet. I was trying with exclamation after sheet name also and does
not work.


On Jan 31, 2:14 am, Dave Peterson wrote:
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


--

Dave Peterson



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
Excel: Relative worksheet references? Busy Beaver Excel Discussion (Misc queries) 2 September 10th 06 04:32 PM
mail merging 2 workbooks??? Bubba Gump Excel Discussion (Misc queries) 21 August 7th 06 09:13 AM
How do I get ONLY new info from 1 Worksheet to another automatical Elaine Excel Worksheet Functions 6 July 13th 06 05:45 PM
Search a worksheet, extract rows using a list from another sheet bobf Excel Discussion (Misc queries) 9 August 31st 05 04:56 AM
Comparing a list to a Calendar worksheet. PatrickL Excel Worksheet Functions 0 August 25th 05 04:21 PM


All times are GMT +1. The time now is 09:10 PM.

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

About Us

"It's about Microsoft Excel"