Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to clear box in a userform? 1

Status
Not open for further replies.

kalle82

Technical User
Apr 2, 2009
163
SE
Hi!

I have set up a userform which has two command buttons and one textbox.

Sorry for not psoting the code but it´s at work and Im at home.

One is for creating a thing and the another is for deleting the same thing.

I have some questions related to this.

First i work in word.

So the first button is just pasting a text into, the document and the second button is deleting it.

The textbox adds a number to a bookmarked location in the document.

Now first question.

When deleting text in the document with commandbutton 2.

How do i do to make it empty the textbox when pushing the button, its reffered to as textbox1 in my code.

Second question

Best would be if i could post my text with a paragraphs and stuff inside a bookmark and just recreate it, ive managed to find a amcro which uppdates a bookmark but i cant get it give me like, paragraphs and stuff into my text how do i do that to a bookmark text?

Last question.

Can i lock my delete buton"commandbutton2" until my commandbutton1 is pressed, and the other way around?

So that you cant delete, without having first uinserted the text, and you can insert text after inserting the first time?

If you want i can add my code, on monday!

Thanks in advance :)






 
Answer 1 -

textbox1.text = "" ' clears the contents

Answer 2 -

onclick of the commandbutton2
commandbutton1.enabled = true
commandbutton2.enabled = false

onclick of commandbutton1
commandbutton1.enabled = false
commandbutton2.enabled = true


"I'm living so far beyond my income that we may almost be said to be living apart
 
Thanks alot hmckillop!

Im gonna test this first thing in the morning!
 
Worked like a treat, feeling like i get a hang of it now =)

Thanks HCM!
 
no worries. thanks

"I'm living so far beyond my income that we may almost be said to be living apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top