Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Access variable from form and module?
I have VBA code on forms and VBA code in modules - how do I make a variable
that they can both access? (Or how do I pass infomation between the two?) I want to have a module that has an open database function that I can reuse on different forms. (i.e save me copy pasting database open each time) and then return a variable - I can do this in c++, how do I do it in VBA? Many thanks in advance -- Thanks Parkin_m |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Access variable from form and module?
You need to declare the variable as public on an ordinary module, e.g. type
Public str As String at the top of a module in your project. This is then available throughout the project. "parkin_m" wrote: I have VBA code on forms and VBA code in modules - how do I make a variable that they can both access? (Or how do I pass infomation between the two?) I want to have a module that has an open database function that I can reuse on different forms. (i.e save me copy pasting database open each time) and then return a variable - I can do this in c++, how do I do it in VBA? Many thanks in advance -- Thanks Parkin_m |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unload A Form based on a Variable in my Module | Excel Programming | |||
How to Set a Variable in Another Module? | Excel Programming | |||
Variable in more than one module | Excel Programming | |||
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |