Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calling a module function from a class method


Hello,

I would like to know if it is possible to call a function that has bee
defined in simple module from a method of a class (just as stati
function).

I tried to do it, but I have an error message 424 "Object required
meaning probably that a object.method syntax was expecting.

I tried also to call the function with module_name.function() but i
failed...

Thanks,

Vinc

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Calling a module function from a class method

You should be able to call a public function in standard module from
within a class (but I'd advise against it...) For example:

This in a class module named Class1:

Private Sub Class_Initialize()
MyFunction
End Sub

This in a standard module:

Public Sub Test()
Dim c As Class1
Set c = New Class1
Set c = Nothing
End Sub

Public Function MyFunction() As Boolean
MsgBox "Did it!"
End Function

Run the macro Test and see the message from the function, called from
within the class.

ranafout wrote in message ...
Hello,

I would like to know if it is possible to call a function that has been
defined in simple module from a method of a class (just as static
function).

I tried to do it, but I have an error message 424 "Object required"
meaning probably that a object.method syntax was expecting.

I tried also to call the function with module_name.function() but it
failed...

Thanks,

Vince


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

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
Creating UDF by Class Module (Leo)? Leo Excel Discussion (Misc queries) 1 December 2nd 08 10:59 AM
calling a module [email protected] Excel Discussion (Misc queries) 1 September 28th 07 04:03 PM
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
please give an example of a class module. Mike[_33_] Excel Programming 1 July 24th 03 07:27 AM


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