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 |
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/ |
All times are GMT +1. The time now is 04:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com