ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clear textbox contents (https://www.excelbanter.com/excel-programming/289218-clear-textbox-contents.html)

dirt

clear textbox contents
 
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



Tom Ogilvy

clear textbox contents
 
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 = ""

--
Regards,
Tom Ogilvy

dirt wrote in message
.. .
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


"Tom Ogilvy" wrote in message
...
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.

--
Regards,
Tom Ogilvy



dirt wrote in message
. ..
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










All times are GMT +1. The time now is 01:18 PM.

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