Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Calling Worksheet SubProcs From Module

Good Afternoon.

I have 5 Public Subs() in 5 different worksheets. I have
the following code in Module 2 that I would like to use
to call all 5 subs. But I keep getting a "sub or
function not defined" error:

CODE:
Public Sub SendDataToReport()
Call SendToWord
Call SendToWord2
Call SendToWord3
Call SendToWord4
Call SendToWord5
End Sub
/CODE:

Why does this happen? How can I call all five subs from
within module 2? All worksheet subs are public not
private.

Suggestions?

Thanks for the help

chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calling Worksheet SubProcs From Module

Best would not to have them in the worksheets - reserve worksheet code for
events associated with the worksheet.

If you wish to keep them there, preface them with the sheet code name

CODE:
Public Sub SendDataToReport()
Call Sheet1!SendToWord
Call Sheet2!SendToWord2
Call Sheet3!SendToWord3
Call Sheet4!SendToWord4
Call Sheet5!SendToWord5
End Sub

--
Regards,
Tom Ogilvy



"Chris Villanueva" wrote in message
...
Good Afternoon.

I have 5 Public Subs() in 5 different worksheets. I have
the following code in Module 2 that I would like to use
to call all 5 subs. But I keep getting a "sub or
function not defined" error:

CODE:
Public Sub SendDataToReport()
Call SendToWord
Call SendToWord2
Call SendToWord3
Call SendToWord4
Call SendToWord5
End Sub
/CODE:

Why does this happen? How can I call all five subs from
within module 2? All worksheet subs are public not
private.

Suggestions?

Thanks for the help

chris



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calling Worksheet SubProcs From Module

Thanks for the info Tom. I will incorporate your advice
into my programming style. Thanks again.

Chris

-----Original Message-----
Best would not to have them in the worksheets - reserve

worksheet code for
events associated with the worksheet.

If you wish to keep them there, preface them with the

sheet code name

CODE:
Public Sub SendDataToReport()
Call Sheet1!SendToWord
Call Sheet2!SendToWord2
Call Sheet3!SendToWord3
Call Sheet4!SendToWord4
Call Sheet5!SendToWord5
End Sub

--
Regards,
Tom Ogilvy



"Chris Villanueva" wrote in message
...
Good Afternoon.

I have 5 Public Subs() in 5 different worksheets. I

have
the following code in Module 2 that I would like to use
to call all 5 subs. But I keep getting a "sub or
function not defined" error:

CODE:
Public Sub SendDataToReport()
Call SendToWord
Call SendToWord2
Call SendToWord3
Call SendToWord4
Call SendToWord5
End Sub
/CODE:

Why does this happen? How can I call all five subs

from
within module 2? All worksheet subs are public not
private.

Suggestions?

Thanks for the help

chris



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Calling Worksheet SubProcs From Module

Actually, the ! should be a period - my mistake.

Public Sub SendDataToReport()
Call Sheet1.SendToWord
Call Sheet2.SendToWord2
Call Sheet3.SendToWord3
Call Sheet4.SendToWord4
Call Sheet5.SendToWord5
End Sub

--
Regards,
Tom Ogilvy


"ChrisV" wrote in message
...
Thanks for the info Tom. I will incorporate your advice
into my programming style. Thanks again.

Chris

-----Original Message-----
Best would not to have them in the worksheets - reserve

worksheet code for
events associated with the worksheet.

If you wish to keep them there, preface them with the

sheet code name

CODE:
Public Sub SendDataToReport()
Call Sheet1!SendToWord
Call Sheet2!SendToWord2
Call Sheet3!SendToWord3
Call Sheet4!SendToWord4
Call Sheet5!SendToWord5
End Sub

--
Regards,
Tom Ogilvy



"Chris Villanueva" wrote in message
...
Good Afternoon.

I have 5 Public Subs() in 5 different worksheets. I

have
the following code in Module 2 that I would like to use
to call all 5 subs. But I keep getting a "sub or
function not defined" error:

CODE:
Public Sub SendDataToReport()
Call SendToWord
Call SendToWord2
Call SendToWord3
Call SendToWord4
Call SendToWord5
End Sub
/CODE:

Why does this happen? How can I call all five subs

from
within module 2? All worksheet subs are public not
private.

Suggestions?

Thanks for the help

chris



.



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
calling a module [email protected] Excel Discussion (Misc queries) 1 September 28th 07 04:03 PM
calling up information from a different worksheet. Jay Adams Excel Worksheet Functions 0 October 8th 06 09:33 AM
Calling VBA function that is in another module Jag Man Excel Programming 2 January 7th 04 03:37 AM
Calling a module function from a class method ranafout[_2_] Excel Programming 1 November 12th 03 11:08 AM
Calling Macros oustide current module Mic[_2_] Excel Programming 2 October 28th 03 05:52 PM


All times are GMT +1. The time now is 12:03 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"