Hi everyone,
I really need a help with this. I have protected worksheet, I'm able to insert images into sheet but image itself is locked, so I can't resize etc it. Is it possible that inserted image automatically unlocks itself??
This is the code I'm using to insert images:
I really need a help with this. I have protected worksheet, I'm able to insert images into sheet but image itself is locked, so I can't resize etc it. Is it possible that inserted image automatically unlocks itself??
This is the code I'm using to insert images:
Code:
Sub InsertPic()
ActiveSheet.Unprotect
Dim myPicture As String
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", _
, "Select Folder to Import")
If myPicture = "False" Then Exit Sub
myPicture = Left(myPicture, InStrRev(myPicture, "\"))
InsertAllPix Range("A50"), _
myPicture, _
"*.jpg"
ActiveSheet.Protect
End Sub
Code:
Sub InsertAllPix(r As Range, ByVal sDir As String, sFilt As String)
ActiveSheet.Unprotect
Dim **** As String
Dim iRow As Long
If Right(sDir, 1) <> "\" Then sDir = sDir & "\"
**** = Dir(sDir & sFilt)
Do While Len(****)
iRow = iRow + 1
With ActiveSheet.Pictures.Insert(sDir & ****)
.ShapeRange.LockAspectRatio = msoFalse
.Height = r(iRow, 1).Height
.Width = r(iRow, 1).Width
.Top = r(iRow, 1).Top
.Left = r(iRow, 1).Left
.Placement = xlMoveAndSize
End With
**** = Dir
Loop
ActiveSheet.Protect
End Sub
Last edited: