Vlookup Picture

Solved/Closed
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 - Aug 9, 2011 at 12:39 PM
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 - Aug 17, 2011 at 09:34 PM
Dear Sir,

In $F$8 i have inserted the data validation list Where the name of Pic is to be select. I want to know how to call a picture in excel 2007 with their name from the given path and if the selected name was not found on the path then msgbox.


Looking forward to your usual co-operation.


Regards,
GameStartNow

3 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 9, 2011 at 07:37 PM
0
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 7
Aug 10, 2011 at 09:27 AM
I have already tried this. If i type pic name first time it appears it but if i type second time, macro appears the pic but it didn't delete the previous pic from the sheet.
0
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 7
Aug 10, 2011 at 09:30 AM
And It Didnot Give The Msg Box If The Pic Was Not Found. And If The Pic Was Not Found It Didn't Blank The Old Pic. It Still Appears
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 10, 2011 at 06:24 PM
There is no delete in that code. It is based on assumption that one adds picture. How can one say what picture to delete or not.

From what I see, if the picture file is not present, it would print the msg saying picture not found. From what I recall who ever used it found both functionality to be working fine.
It does not have a delete functionality,
0
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 7
Aug 14, 2011 at 05:03 AM
Sir I am using this formula and it works fine but i just want to add a few code in this.

I just want the condition that if the pic was not found in the given path then it shows the msgbox "Pic was not found" and show the Pic named No Photo.jpg

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewPic As String
If Target.Address = "$E$9" Then
NewPic = "F:\" & Range("E10").Value
Target.Comment.Shape.Fill.UserPicture NewPic
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 14, 2011 at 07:50 AM
Use the DIR command before you try to add the picture to check if the file is present or not. (see in that thread if confused)
0
Game Start Now Posts 138 Registration date Thursday January 21, 2010 Status Member Last seen May 8, 2019 7
Aug 14, 2011 at 09:45 PM
I had already try that but didn't succeed...... thats why asking here friend
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Aug 15, 2011 at 07:19 AM
NewPic = "F:\" & Range("E10").Value

If Dir(NewPic) = "" then
NewPic = "F:\NoPhoto.jpg"
msgbox "Missing a picture"
end if

Target.Comment.Shape.Fill.UserPicture NewPic
0