> is located in the class module

Hi Matt,

Classes are definitions of objects.  You can't call a class (or any
procedure in it) at all.  You can call those procedures as methods of an
object instantiated from the class.

 

I barely looked at the code, but see if this example points you in the right
direction.  It creates an instance of the Functions class and then gets a
return value from LiquidityReport:

Dim Funcs As Functions

Dim LR As Variant

Set Funcs = New Functions

LR = Funcs.LiquidityReport()

 

OK, just looked a little closer.  I am puzzled by two things:

1.       Why are you using a class module?  This function doesn't appear to
do anything that benefit from classing.  You probably want to put it in a
standard module.  In that case you'd refer to it, assuming the standard
module was also called Functions, either the same as you would were it in
the same module you're calling it from, or as Functions.LiquidityReport in
case you might have a public function elsewhere with the same name.

2.       Why are you using a function?  It doesn't actually appear to return
a value.  The purpose of a function is to return a value.  If you aren't
returning a value, you probably want to use a SUB procedure.

 

Asa

 

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Matt
Sent: Friday, April 06, 2012 8:54 AM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Re: Call a Function

 

Hi Guys, here is the link to the file. I apologize as it has references to
other files and locations on the network I use so it probably won't work for
you. 

 <https://www.box.com/shared/43875364325ed5a8fd57>
https://www.box.com/shared/43875364325ed5a8fd57

If  you were to run the "Pass Array" macro, and try and call this function
at the bottom of the "receive array" sub. 

The function is called the "Liquidity Report" and is located in the class
module. Again, it seems to work if its in the same module but for some
reason I can't separate it into its own module..

 

Any help would be awesome!

Tx again.

Matt


On Thursday, April 5, 2012 2:56:14 PM UTC-4, Matt wrote:

Hello, I'm trying to call a public function in one module from another Sub
procedure in another module and it won't call the the function. I get an
error that says.."sub function not defined" But when I include the function
within the same module, my code works...

 

I can't seem to find the answer online...

 

 

What is the problem?

Thanks again for your help.

 

Matt

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security
measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
 
----------------------------------------------------------------------------
--------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to