How do I insert an image into a specific cell within a protected .

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I insert an image into a specific cell within a protected worksheet.
I have created an order form that is protected so users can only enter data
into specific cells. However, I would like users to be able to insert a
graphic file/image into a specific set of merged cells. Please help.

Thanks,
Scott
 
I think I'd give them a macro to do it.

The macro would ask for the filename, unprotect the sheet, add the graphic to
the correct location, and reprotect the sheet.

Option Explicit
Sub testme02()

Dim myPictureName As Variant
Dim myPict As Picture
Dim myRng As Range

myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")

If myPictureName = False Then
Exit Sub 'user hit cancel
End If

With Worksheets("sheet1")
.Unprotect Password:="hi"
Set myRng = .Range("A1:e10")
Set myPict = .Pictures.Insert(myPictureName)
myPict.Top = myRng.Top
myPict.Width = myRng.Width
myPict.Height = myRng.Height
myPict.Left = myRng.Left
myPict.Placement = xlMoveAndSize
.Protect Password:="hi"
End With
End Sub
 

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

Back
Top