ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protect several objects (https://www.excelbanter.com/excel-programming/407245-protect-several-objects.html)

Jarle

Protect several objects
 
I have several textboxes on a worksheet.

I will have to protect the text in these boxes with help of vba code. When
protecting text in one specific textbox I use:

Worksheets(1).Shapes("txtbox1").LockedText = True

I want to protect all boxes with one command. I am thinking about something
like

For each Textbox in Worksheets(1)
LockedText = True

I am struggling with the syntax to make this work. Can anybody help me out?

rgds
Jarle

..


Dave Peterson

Protect several objects
 
Dim TBox As TextBox
For Each TBox In Worksheets("Sheet1").TextBoxes
TBox.LockedText = True
Next TBox

Jarle wrote:

I have several textboxes on a worksheet.

I will have to protect the text in these boxes with help of vba code. When
protecting text in one specific textbox I use:

Worksheets(1).Shapes("txtbox1").LockedText = True

I want to protect all boxes with one command. I am thinking about something
like

For each Textbox in Worksheets(1)
LockedText = True

I am struggling with the syntax to make this work. Can anybody help me out?

rgds
Jarle

.


--

Dave Peterson

Jarle

Protect several objects
 
Thanks again, Dave!

Dave Peterson skrev:

Dim TBox As TextBox
For Each TBox In Worksheets("Sheet1").TextBoxes
TBox.LockedText = True
Next TBox

Jarle wrote:

I have several textboxes on a worksheet.

I will have to protect the text in these boxes with help of vba code. When
protecting text in one specific textbox I use:

Worksheets(1).Shapes("txtbox1").LockedText = True

I want to protect all boxes with one command. I am thinking about something
like

For each Textbox in Worksheets(1)
LockedText = True

I am struggling with the syntax to make this work. Can anybody help me out?

rgds
Jarle

.


--

Dave Peterson



All times are GMT +1. The time now is 04:13 PM.

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