Enable Multiline option on Sheet Textboxes when sheet is protected for userinterfaceonly=true

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
As the title reads. It seems you cannot press enter to move to a new line for textbox.... atleast I have not been able to figure this out. So is there a way to enable this so the user can hit enter and go to a new line or do they really have to hit ctrl shift enter which would be cumbersome to explain to every user..
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You must be referring to an ActiveX textbox, correct? If so, in addition to setting the MultiLine property to True, you can set the EnterKeyBehaviour property to True.
 
Upvote 0
You must be referring to an ActiveX textbox, correct? If so, in addition to setting the MultiLine property to True, you can set the EnterKeyBehaviour property to True.

No I am using the shape textboxes and not the activex ones. Any ideas?
 
Upvote 0
When you set UserInterfaceOnly to True, set DrawingObjects to False. For example...

Code:
Worksheets("Sheet1").Protect, DrawingObjects:=False, UserInterfaceOnly:=True

To set it manually...

Code:
Ribbon >> Review >> Protect sheet >> Edit objects >> click OK
 
Upvote 0
When you set UserInterfaceOnly to True, set DrawingObjects to False. For example...

Code:
Worksheets("Sheet1").Protect, DrawingObjects:=False, UserInterfaceOnly:=True

To set it manually...

Code:
Ribbon >> Review >> Protect sheet >> Edit objects >> click OK

I guess I should have mentioned that I do not want shapes to be movable which this option allows for.
 
Upvote 0
In that case, try the following...

Code:
Right-click the shape/textbox > Format Shape > Properties > and uncheck "Lock text" > Close
 
Last edited:
Upvote 0
In that case, try the following...

Code:
Right-click the shape/textbox > Format Shape > Properties > and uncheck "Lock text" > Close

So the shape is created via addtextbox through part of the macro and I have set the property of locktext to false via vba. So of the combinations I have tried it seems that when setting locked cells to be selectable is the only combination I have found where you can still use the typical textbox functions like enter, tab, arrow keys, etc. Any other ideas then?
 
Upvote 0
In order to set the property for LockedText, you'll need to access the ControlFormat object. For example, let's say that tb represents a Shape object, you'll need to do the following...

Code:
[I]tb[/I].ControlFormat.LockedText = False

Have you done so?
 
Upvote 0
In order to set the property for LockedText, you'll need to access the ControlFormat object. For example, let's say that tb represents a Shape object, you'll need to do the following...

Code:
[I]tb[/I].ControlFormat.LockedText = False

Have you done so?

Yes I have done and it allows me to edit the text but I am still left with the problem of not being able to press enter if the sheet is protected for user interface and the drawingobjects:=false allows the user to move the textbox which I did not want.
 
Last edited:
Upvote 0
Set DrawingObjects to True. Or, since the default value is True, you can omit the argument altogether.
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,580
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top