PC Review


Reply
Thread Tools Rate Thread

Create UDF in Class Moduels? (frm Leo)

 
 
Leo
Guest
Posts: n/a
 
      2nd Dec 2008
Dear Experts,
I recently became interested in style of using Class Modules.
I need to know if we can use Class Modules to creat User Defined
Functions?
(functions that is useable in Excel sheet like a normal worksheet
function)
if yes, please explain how, and show a simple sample.
thanks in advance.

--
Thans & Best regards
Leo, InfoSeeker
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      2nd Dec 2008
See response in .misc.

--
__________________________________
HTH

Bob

"Leo" <(E-Mail Removed)> wrote in message
news:5799F749-4C2E-4BEE-B0BB-(E-Mail Removed)...
> Dear Experts,
> I recently became interested in style of using Class Modules.
> I need to know if we can use Class Modules to creat User Defined
> Functions?
> (functions that is useable in Excel sheet like a normal worksheet
> function)
> if yes, please explain how, and show a simple sample.
> thanks in advance.
>
> --
> Thans & Best regards
> Leo, InfoSeeker



 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      2nd Dec 2008
A class module is particularly unsuitable for UDFs, because you must
create an instance of a class to use anything contained within the
class, and Excel has no knowledge of what objects may or may not have
been created by VBA at any particular time. As a general rule, UDFs
should be in regular code modules, not class modules. For more info
about class modules, see http://www.cpearson.com/Excel/Classes.aspx.
For more info about UDFs, see
http://www.cpearson.com/Excel/Writin...ionsInVBA.aspx.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Tue, 2 Dec 2008 01:04:05 -0800, Leo <(E-Mail Removed)>
wrote:

>Dear Experts,
>I recently became interested in style of using Class Modules.
>I need to know if we can use Class Modules to creat User Defined
>Functions?
>(functions that is useable in Excel sheet like a normal worksheet
>function)
>if yes, please explain how, and show a simple sample.
>thanks in advance.

 
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
Assume I create a class Customer is it advice to have a separate class to store addresses Tony Johansson Microsoft C# .NET 6 25th Jan 2011 12:56 AM
How do I create partial class to be nested under the main class file? Joseph Geretz Microsoft C# .NET 2 29th Mar 2007 03:42 AM
How to have New() in a Base Class create and return an instance of a Derived Class? Joe HM Microsoft VB .NET 4 22nd Nov 2005 09:31 PM
Why I can't create a contructor in a class inherited from Component Model class C.G. Oh Microsoft Dot NET Framework 0 19th Nov 2004 02:09 PM
Activator could not create a instance of the class as the Length of the class name is 36 characters Jack Wright Microsoft C# .NET 0 18th Mar 2004 04:21 AM


Features
 

Advertising
 

Newsgroups
 


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