Pictures in Forms

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

Guest

Hi

I'm setting up a form and have unlocked the cells that need input and the
form is running okay including all the picklists etc. But in some of the
cells I require photographs inserting by the users and can't work out how to
format the cell or protection to allow this. Please could someone help?
 
Sub Insert_Pict()
Dim Pict
Dim ImgFileFormat As String
Dim PictCell As Range
Dim Ans As Integer

ActiveSheet.Protect True, True, True, True, True
ImgFileFormat = "Image Files (*.bmp),others, tif (*.tif),*.tif, jpg
(*.jpg),*.jpg"

GetPict:
Pict = Application.GetOpenFilename(ImgFileFormat)
'Note you can load in any nearly file format
If Pict = False Then End

Ans = MsgBox("Open : " & Pict, vbYesNo, "Insert Picture")
If Ans = vbNo Then GoTo GetPict

'Now paste to userselected cell
GetCell:
Set PictCell = Application.InputBox("Select the cell to insert into",
Type:=8)
If PictCell.Count > 1 Then MsgBox "Select ONE cell only": GoTo GetCell
PictCell.Select
ActiveSheet.Pictures.Insert(Pict).Select


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