basically, if its a private function then no if its public then yes!!
If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
The Great Date Debate Thread222-368305
File Formats Galore @
Sure you can! Let's say for example you have a function under Form1 named MyFunction(...).
Make sure it's Public Function ... and then just call it with
Form1.MyFunction(...)
or
Call Form1.MyFunction(...)
Declare it as Public in a form module and call it as :[tt]
x = Form1.myFunc()
[/tt]
(where Form1 is the name of the form containing the function and myFunc is the name of the function.
Or Declare it as Public in a Code (.bas) module and just use it by name;
[tt]x = myFunc()[/tt]
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
ok... so i forgot a little detail... but hey!! its late...
If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
A General Guide To Excel in VB FAQ222-3383
The Great Date Debate Thread222-368305
File Formats Galore @
By now I think you understand that the function must be public or called by a routine on the form that is public.
What gets tricky is setting a variable on one form from another. If you need to do that, you must set a reference to the specific instance of the targeted form on the form that will set the variable. Otherwise VB will give you a new instance of the targeted form that is not visable.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.