Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Dan,
In order to lock the text, the worksheet must be protected. The code below will unprotect the sheet, add a shape to it, add the text, then lock the text while still allowing you to move the shape around, and finally re-protect the sheet. Sub AddLockedTextShape() Dim ws As Worksheet Dim shp As Shape Dim rng As Range Dim w As Single Dim h As Single w = 48# ' standard cell width h = 12.75 ' standard cell height Set ws = ActiveSheet Set rng = ws.Range("C3") ws.Unprotect ' optional: use a password Set shp = ws.Shapes.AddShape(msoShapeRectangle, rng.Left, rng.Top, w, 4 * h) shp.TextFrame.Characters.Text = "My Text" shp.Select ' These don't have any affect unless the sheet is protected With Application.Selection .LockedText = True .Locked = False End With ws.Protect Set rng = Nothing Set shp = Nothing Set ws = Nothing End Sub HTH, Nick Hebb BreezeTree Software http://www.breezetree.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
searching for text inside a text box | Excel Discussion (Misc queries) | |||
How to embed large number of variables in text inside a text box? | Excel Discussion (Misc queries) | |||
Cutting and pasting large variable text into a text box shape usin | Excel Programming | |||
How to make the text inside Text Box upside down? | Excel Discussion (Misc queries) | |||
Editing text in text box grouped within a trapezoid | Excel Programming |