How to protect a textbox in VBA/Excel 2003 ?

G

Guest

Hi,

When protecting the textboxes in my worksheet, I cannot write text to the
box in VBA. How can I unprotect it in my VBA-code, write text in it and then
protect it again ? I want to prevent that the application user moves the
textbox or alters the content: how to do this ?

Greets,

Tom
 
G

Guest

Set lock =false before you write to it and then to locked =true when you are
done writting to it like so:

ActiveSheet.Shapes("TextBox1").Locked = True
Code that writes to the text box goes here
ActiveSheet.Shapes("TextBox1").Locked = False
 
G

Guest

Hi Michael,

This gives a runtime error 1004 Application-defined or object-defined error.
What's wrong ?

Greets,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top