ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problems with a userform (https://www.excelbanter.com/excel-programming/339330-re-problems-userform.html)

sebastienm

problems with a userform
 
Hi,
1. Where/How are a and b declared (which module; outside of any procedure or
whitin a procedure).
2. From the online help about the 'End' statement:
"When executed, the End statement resets all module-level variables and all
static local variables in all modules. "

3."variables that save his value in all the program :"
Declare it as Public in a general code module. However, you have to be aware
that while codinng the application, going in the VBE and editing the code may
reset variables. Therefore sometimes, you run the application, the variables
are set, but you want to change the code so you go in the VB Editior which
resets these variables.
4. "variables that save his value althougt the program is close and open
again"
You can write them to a file (see help topic Writing Data To FIles; the
Open/Close/Get/Write/Put statements), to the registry if you want to save
application level data such as options, or if your application processes xl
files, you could save the variables in these books.
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"filo666" wrote:

Hi, I have a userform with 2 textboxes:

Private Sub CommandButton1_Click()

a=textbox1
b=textbox2
macro1 'execute the macro1
end
end sub

sub Macro1()
msgbox a,vbokonly,b
end sub

my problem is that when the userform lost focus the variables lost their
value, I mean, when macro1 is called a and b appears as a=empty and b=empty
and I want the values od textbox1 and textbox2

How to savfe the variables so they are available using the macro1 ???

Aldo I would like to know information about deffining variables that save
his value in all the program and also variables that save his value althougt
the program is close and open again

TIA



All times are GMT +1. The time now is 07:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com