How to allow moving shapes, but prevent editing their text on a worksheet

Antar

New Member
Joined
Feb 12, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I have a challenge to overcome, but couldn't find any hint yet and hope you guys can help. I need to create shapes (e.g. msoShapeRectangle) with specific texts in them in a worksheet. Once created, I want to allow users to move the shapes on the worksheet, but I want to prevent them, editing the text which had been written in the shapes. How can I achieve this?
Many thanks in Advance!
Antar
 
No. Don't mix up the API based code with the one based on the AlternativeText Property

Follow these steps.
1) Start with an empty workbook and add some shapes with texts (Don't add Alt Texts)
2) Place the code in post#3 inside the ThisWorkbook Module (not inside a standard module)
3) Save the workbook and close it.
4) Reopen the workbook... It should now work as expected.
 
Last edited:
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I have a challenge to overcome, but couldn't find any hint yet and hope you guys can help. I need to create shapes (e.g. msoShapeRectangle) with specific texts in them in a worksheet. Once created, I want to allow users to move the shapes on the worksheet, but I want to prevent them, editing the text which had been written in the shapes. How can I achieve this?
Many thanks in Advance!
Antar

Sorry to add to this post but I had this issue myself and I use this solution as I'm not that great with VBA but this works as an alternative to using code.
Insert a Text Box anywhere
Type in "Antar Testshape" for example text
Choose Font/Size
Format Shape to No Fill and No Line
Highlight Shape and right click then cut
Will disappear but right click again and click on 3rd box on Paste Special and it will bring back text as a picture
You can then repeat and place on shapes you create and Group shape/text
This will allow you to move shapes but you cannot edit the text
 
Upvote 0

Sorry to add to this post but I had this issue myself and I use this solution as I'm not that great with VBA but this works as an alternative to using code.
Insert a Text Box anywhere
Type in "Antar Testshape" for example text
Choose Font/Size
Format Shape to No Fill and No Line
Highlight Shape and right click then cut
Will disappear but right click again and click on 3rd box on Paste Special and it will bring back text as a picture
You can then repeat and place on shapes you create and Group shape/text
This will allow you to move shapes but you cannot edit the text
Thank you chef. This is also a solution. However, in my case it doesn't work, since I would need to read the text from the shapes sometime.
Good to have this solution here, if someone else is searching for an alternative.
Also, I was thinking of creating 2 shapes with same sizes. Putting the text in one and leaving the second one above it without text, then grouping those 2 shapes and consider them as 1.
However, Jaafar's solution seems to be better than mine.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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