ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,199
- Office Version
- 2007
- Platform
- Windows
Morning,
I have some customers of which i need to hyperlink to there respective jpg photo.
I have the existing working code shown below which allows me to select the customer, run the code & then that customer is now hyperlink to its own jpg photo.
So customer TOM JONES 001 is now hyperlinked to photo in folder TOM JONES 001.jpg
This code is great if i only need to select the odd one or two but at present i have about 200 etc.
So can we edit the existing code so when its run it will apply the hyperlink to each customer automatically.
There are some customers names in this column that doesnt require a hyperlink & obviously there isnt a jpg photo in the folder for them.
Some info for you to assist.
Worksheet called POSTAGE
Customers names are in column B
Path to photos is EBAY%20CUSTOMERS%20PHOTOS\
Have a nice day
I have some customers of which i need to hyperlink to there respective jpg photo.
I have the existing working code shown below which allows me to select the customer, run the code & then that customer is now hyperlink to its own jpg photo.
So customer TOM JONES 001 is now hyperlinked to photo in folder TOM JONES 001.jpg
This code is great if i only need to select the odd one or two but at present i have about 200 etc.
So can we edit the existing code so when its run it will apply the hyperlink to each customer automatically.
There are some customers names in this column that doesnt require a hyperlink & obviously there isnt a jpg photo in the folder for them.
Some info for you to assist.
Worksheet called POSTAGE
Customers names are in column B
Path to photos is EBAY%20CUSTOMERS%20PHOTOS\
VBA Code:
Private Sub Hyperlink999_Click()
Const FILE_PATH As String = "C:\Users\Ian\Desktop\REMOTES ETC\DR\EBAY CUSTOMERS PHOTOS\"
If ActiveCell.Column = Columns("B").Column Then
If Len(Dir(FILE_PATH & ActiveCell.Value & ".jpg")) Then
ActiveCell.Hyperlinks.Add Anchor:=ActiveCell, Address:=FILE_PATH & ActiveCell.Value & ".jpg"
MsgBox "HYPERLINK WAS SUCCESSFUL.", vbInformation, "POSTAGE SHEET HYPERLINK MESSAGE"
End If
Else
MsgBox "PLEASE SELECT A CUSTOMER FIRST TO HYPERLINK THE PHOTO.", vbCritical, "POSTAGE SHEET HYPERLINK MESSAGE"
Exit Sub
End If
If Dir(FILE_PATH & ActiveCell.Value & ".jpg") = "" Then
If MsgBox("THERE IS NO PHOTO FOR THIS CUSTOMER" & vbNewLine & "WOULD YOU LIKE TO OPEN THE PHOTO FOLDER ?", vbYesNo + vbCritical, "HYPERLINK CUSTOMER PHOTO MESSAGE.") = vbYes Then
CreateObject("Shell.Application").Open ("C:\Users\Ian\Desktop\REMOTES ETC\DR\EBAY CUSTOMERS PHOTOS\")
End If
End If
End Sub
Have a nice day