Hi i have got userform whereby user select the on the image and it changes to hyperlink and add the hyperlink to a cell however when tried opening the hyerlink it wort open, can someone point me in the right direction please.
VBA Code:
Private Sub CommandButton3_Click()
On Error GoTo errHandler:
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("VehicleRejected")
Dim n As Long
Dim answer As String
Dim strFileName As String
Application.EnableCancelKey = xlDisabled
Application.ScreenUpdating = False
Application.EnableEvents = False
''''''''''''''''''''
n = sh.Range("A" & Application.Rows.Count).End(xlUp).Row
strFileName = Application.GetOpenFilename(filefilter:="Tiff Files(*.tif;*.tiff),*.tif;*.tiff,JPEG Files (*.jpg;*.jpeg;*.jfif;*.jpe),*.jpg;*.jpeg;*.jfif;*.jpe,Bitmap Files(*.bmp),*.bmp", FilterIndex:=2, Title:="Select a File", MultiSelect:=False)
TextBox65 = strFileName 'use to save URL or Link from picture
If strFileName = "False" Then
MsgBox "File Not Selected!"
Else
'load picture to Image control, using LoadPicture property
Me.Image2.Picture = LoadPicture(strFileName)
End If
sh.Unprotect "1234"
sh.Range("i" & n + 1).Value = Me.TextBox65.Value
sh.Range("i" & n + 1).Select
With ActiveSheet
.Hyperlinks.Add Anchor:=sh.Range("i" & n + 1), Address:=",TextToDisplay, """
End With
sh.Protect "1234"
MsgBox "Updated Successfully!!!", vbInformation
Unload Me
Application.EnableEvents = True
Application.ScreenUpdating = True
Worksheets("VehicleRejected").Activate
Worksheets("VehicleRejected").Cells(1, 3).Select
Exit Sub
errHandler:
MsgBox "An Error has Occurred " & vbCrLf & "The error number is: " _
& Err.Number & vbCrLf & Err.Description & vbCrLf & _
"Please Contact Admin", vbCritical, "Error Message"
End Sub