Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
I have a form with 4 different text boxes in a form. When a command
button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
In a General module (not in the userform module, not in a worksheet module, not
in the ThisWorkbook module), declare your 4 variables and make them public. Option Explicit Public myVar1 as string etc Then when your userform is ready (in the okbutton click event???): myVar1 = me.textbox1.value etc Matthew Dyer wrote: I have a form with 4 different text boxes in a form. When a command button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this? -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
On Oct 7, 1:28*pm, Dave Peterson wrote:
In a General module (not in the userform module, not in a worksheet module, not in the ThisWorkbook module), declare your 4 variables and make them public. Option Explicit Public myVar1 as string etc Then when your userform is ready (in the okbutton click event???): myVar1 = me.textbox1.value etc Matthew Dyer wrote: I have a form with 4 different text boxes in a form. When a command button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this? -- Dave Peterson What do you mean by General Module? I can only create Modules in a workbook... |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
Open excel
Go into the VBE. Click on Insert and choose module You may not be able to create a module for each worksheet, but excel can. You may not be able to create a module for ThisWorkbook, but excel can. You can create a userform and excel will create the module that sits behind that userform. You can insert a class module, too. Matthew Dyer wrote: On Oct 7, 1:28 pm, Dave Peterson wrote: In a General module (not in the userform module, not in a worksheet module, not in the ThisWorkbook module), declare your 4 variables and make them public. Option Explicit Public myVar1 as string etc Then when your userform is ready (in the okbutton click event???): myVar1 = me.textbox1.value etc Matthew Dyer wrote: I have a form with 4 different text boxes in a form. When a command button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this? -- Dave Peterson What do you mean by General Module? I can only create Modules in a workbook... -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
referencing a variable from a form in a module | Excel Programming | |||
VBA code in one Module referencing Public Variables Declared inanother Module failing | Excel Programming | |||
Transfer Variable from Form to Module | Excel Programming | |||
Access variable from form and module? | Excel Programming | |||
Unload A Form based on a Variable in my Module | Excel Programming |