How to protect a textbox in VBA/Excel 2003 ?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Hi Michael,

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

Greets,

Tom
 
Back
Top