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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
21,001
Office Version
  1. 365
Platform
  1. Windows
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

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
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

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
21,001
Office Version
  1. 365
Platform
  1. Windows
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

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
ADVERTISEMENT
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

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
21,001
Office Version
  1. 365
Platform
  1. Windows
In that case, try the following...

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

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
ADVERTISEMENT
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

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
21,001
Office Version
  1. 365
Platform
  1. Windows
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

bradyboyy88

Well-known Member
Joined
Feb 25, 2015
Messages
562
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

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
21,001
Office Version
  1. 365
Platform
  1. Windows
Set DrawingObjects to True. Or, since the default value is True, you can omit the argument altogether.
 
Upvote 0

Forum statistics

Threads
1,195,717
Messages
6,011,282
Members
441,598
Latest member
chrispaulpearce

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
Top