How separate text boxes from pictures in the same worksheet by code?

M

Marie J-son

Hi everyone,
I have PICTURES (created by "CopyPicture method" by the way) embedded in a
excel worksheet and I want to allow to copy them. I ALSO in the same sheet
have TEXT BOXES and I want to protect their text. I tried with
drawingobjects.select, but found out that a picture is a drawing object.

Is there a specified objecttype just for text boxes I can use to protect
just them? [Sheet1.TextBoxes.Protect = True would be nice..but doesn't
exist.]

I DON'T want to change from text boxes to merged cells , I have just left
that track of several reasons. I want my boxes protected (and protected
cells in the sheet) and allow copy the pictures

/BEST REGARDS
and thanks in advance
 
G

Gunnar Johansson

Here is the solution

Sub LockTextBoxNotPic()
Dim myShape As Shape
For Each myShape In ActiveSheet.Shapes
If myShape.Type = msoTextBox Then
myShape.Locked = True
Else
If myShape.Type = msoPicture Then
myShape.Locked = False
End If
End If
Next myShape
End Sub


/Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top