PC Review


Reply
 
 
Bishop
Guest
Posts: n/a
 
      10th Apr 2009
I have 2 modules in a particular Project. Each module is a Sub. I'm trying
to call one module within another module and I'm getting the following error:

Compile Error:
Expected variable or procedure, not module

The two modules are: TallySheetRepDump and BanSumSort

This is how I'm trying to call the module:

Sub TallySheetRepDump()
Call BanSumSort
...

I basically want the code inside BanSumSort to run immediately upon the
execution of the TallySheetRepDump routine then continue with the code in
TallySheetRepDump. What am I doing wrong?
 
Reply With Quote
 
 
 
 
jasontferrell
Guest
Posts: n/a
 
      10th Apr 2009
Subroutine names need to be different from the names of the modules.
Just change the subroutine name to "TallySheetRepDumpSub" or something
of the sort.
 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      10th Apr 2009

A module is a container for one or more Sub and/or Function
procedures. It makes no sense to "call a module". Rather, you need to
call the procedure in the module.

Call ProcedureName
' or
Call ModuleName.ProcedureName

Note that a module can contain any number of Sub and/or Function
procedures. It is not required that a module contains only one
procedure (although it is harmless to do so).

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Fri, 10 Apr 2009 10:42:08 -0700, Bishop
<(E-Mail Removed)> wrote:

>I have 2 modules in a particular Project. Each module is a Sub. I'm trying
>to call one module within another module and I'm getting the following error:
>
>Compile Error:
>Expected variable or procedure, not module
>
>The two modules are: TallySheetRepDump and BanSumSort
>
>This is how I'm trying to call the module:
>
>Sub TallySheetRepDump()
> Call BanSumSort
> ...
>
>I basically want the code inside BanSumSort to run immediately upon the
>execution of the TallySheetRepDump routine then continue with the code in
>TallySheetRepDump. What am I doing wrong?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call a public module macro in private module macro emmanuel Webmaster / Programming 1 13th May 2011 06:34 PM
Call Module from SQL =?Utf-8?B?QmlsbCBQaGlsbGlwcw==?= Microsoft Access VBA Modules 5 15th May 2007 01:59 PM
Can't "Call" Error Handler in Standard Module from Form Module =?Utf-8?B?Sm9obiBE?= Microsoft Access VBA Modules 8 21st Apr 2007 07:24 PM
Call a Module mb Microsoft Excel Programming 2 26th Oct 2005 01:12 AM
How to call a Module. Microsoft Access VBA Modules 2 18th Jun 2004 05:02 PM


Features
 

Advertising
 

Newsgroups
 


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