ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting Pictures MKII (https://www.excelbanter.com/excel-programming/386132-inserting-pictures-mkii.html)

Chris Hankin[_4_]

Inserting Pictures MKII
 
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 ***

JE McGimpsey

Inserting Pictures MKII
 
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 ***


Chris Hankin[_4_]

Inserting Pictures MKII
 

Thanks so much JE McGimpsey for your excellent work and help - very much
appreciated.

Cheers,

Chris.


*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 08:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com