ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to protect a textbox in VBA/Excel 2003 ? (https://www.excelbanter.com/excel-programming/396855-how-protect-textbox-vba-excel-2003-a.html)

Tom Emmery

How to protect a textbox in VBA/Excel 2003 ?
 
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

Michael

How to protect a textbox in VBA/Excel 2003 ?
 
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




--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Tom Emmery" wrote:

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


Tom Emmery[_2_]

How to protect a textbox in VBA/Excel 2003 ?
 
Hi Michael,

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

Greets,

Tom

"Michael" wrote:

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




--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Tom Emmery" wrote:

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



All times are GMT +1. The time now is 05:49 PM.

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