First, pictures always reside in the drawing layer above the cells, not
in the cell itself.
Name your cell(s), say, jpgCells. Then put something like this in your
worksheet code module
Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Excel.Range, Cancel As Boolean)
Const csPATH As String = "your path here"
Dim sOldDir As String
Dim vResult As Variant
If Not Intersect(Target, Range("jpgCells")) Is Nothing Then
Cancel = True
sOldDir = CurDir
ChDrive csPATH
ChDir csPATH
vResult = Application.GetOpenFilename( _
filefilter:="Picture Files,*.jpg")
ChDrive sOldDir
ChDir sOldDir
If vResult = False Then Exit Sub 'user cancelled
With Me.Pictures.Insert(vResult)
.Top = Target.Top
.Left = Target.Left
End With
End If
End Sub
In article ,
Chris Hankin wrote:
Hello,
Could some one please help me with the following?
I have some jpg pictures in the following folder location:
G:\WLMAEWCSPO\LMU\LOGISTICS PREPAREDNESS SYSTEMS\LOGPREP SYS\V&A AND SCA
ITEM PHOTOS\
I need a macro so that when a user double-clicks on a certain cell in
column B then a window opens up
enabling the user to select the desired jpg picture and to insert the
picture into the cell (the user just doubled-clicked on)in my workbook
named "Items".
Any help would be greatly appreciated.
Thanks,
Chris.
*** Sent via Developersdex http://www.developersdex.com ***