make userform textbox value permanent

  • Thread starter Thread starter Matt S
  • Start date Start date
M

Matt S

Hi all,

I am creating a userform for a colleague. One of my textboxes outputs the
directory that is selected to save the file after the macro is complete. I
have also given the user a checkbox that will hopefully make the directory to
save a "permanent" value so that the next time he opens the file, that
directory is preselected automatically. It will be permanent unless he
selects another directory and makes the checkbox true again later.

I have tried saving the UserForm1.Textbox9.Value equal to itself, but that
doesn't change the value I assign it in the userform after I close the file
and open it again.

Any help would be appreciated!

Thanks!
Matt
 
VB controls do not save their information... you have to do that yourself.
You can output the value to a text file or save it in a cell on a worksheet
somewhere when the workbook closes and then load it back in when the
UserForm loads up (if you go with the cell idea, you can delete the cell's
content after your UserForm retrieves the value.
 
Thanks Rick. I know I can type in a value in the text box when editing the
userform and this makes it permanent. I will go with the cell idea, though
so it can be changed.

Thanks again,
Matt
 
I know I can type in a value in the text box when editing
then userform and this makes it permanent.

That works because it is a design-time setting (like the font color, or back
color, etc.)... you can change these at run-time but those changes won't
stick.
 
Back
Top