clear textbox contents

  • Thread starter Thread starter dirt
  • Start date Start date
D

dirt

I have a text box on a worksheet used to accept a username input. I would
like to automatically clear the textbox contents when the user logs out but
can't seem to figure out how... Any ideas?

thanks,

Dan
 
I guess you would have to explain by what you mean by logout. Is this done
by running some code in Excel or do you mean if the user does Start=>Logoff
from the windows start menu? Perhaps use the workbook_close event to clear
the textbox and save the workbook.
 
My apologies - I wasn't that clear.
I have a limited access file - the user inputs their name into the text box
and I run a verification program to allow the user to edit the file. If the
user name doesn't match a stored list, the user cannot edit the file. When
the logged in user wishes to exit (using a button and macro to do so), I
save changes but I need to clear the text box at the time the user exits .
Otherwise, when the program is started again, the old username is still in
the text box and all anyone has to do is click the verification button. I
would like to know how to clear the contents of the textbox using macro
code.

thanks, I hope this is a bit clearer...

D
 
assuming the textbox is on Userform1

Userform1.Textbox1.Text = ""

if the textbox is a control toolbox toolbar textbox on a worksheet

worksheets("Sheet1").OleObjects("Textbox1").Object.Text = ""

or
sheet1.Textbox1.Text = ""


if a Textbox from the drawing toolbar on a worksheet

worksheets("sheet1").Textboxes("Text Box 1").Value = ""
 
Back
Top