public function

Hello
How can I create a public object function, that all the forms will recognize the function ???
lirongAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
halapayaConnect With a Mentor Commented:
insert a module. say if you have a module named Main.bas

inside that module you define ur function ;

public function GlobalFunc()
'do ur stuff here
end function


it'll be able to call from any form..
0
 
tureCommented:
lirong,

Put the function in a MODULE and declare it like this:

Public Function Twice(t As String) As String
  Twice = t & t
End Function

Ture Magnusson
Karlstad, Sweden
0
 
tkuppinenCommented:
Place the function in a module(.bas file).  To create a new module right click in the project explorer and add a new module.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
lirongAuthor Commented:
But the the function is using an object
(such as MCIcontrol), and when I placed it in the class module I got an error...

0
 
tkuppinenCommented:
What was your error?

halapaya
How was your "answer" different from the comments above?
0
 
bonggoyCommented:
If you want something like the App object or the Debug object, you need to create an ActiveX DLL.

Here's how:

- Create an ActiveX DLL project.
- Add a class and set it's Instancing property to "GlobalMultiUse"
- Add the Public Function (method) that you need to call anywhere in your form.
- Create the DLL.
- Reference the DLL in your project and you can now call the public function that you created.




0
All Courses

From novice to tech pro — start learning today.