Hi all
Not sure what is going on with this, I need my code to add a user selected hyperlink through the dialogue box, into a table on a different worksheet. I don't want to overwrite the current cell value with the screen tip either,
What it is doing, is adding the root part of the hyperlink (with \True on the end) to the correct cell but then the last part of the hyperlink - from desktop\ onward to the current active cell (along with writing the screen tip to that cell).
Can anyone point out what i've got wrong?
Not sure what is going on with this, I need my code to add a user selected hyperlink through the dialogue box, into a table on a different worksheet. I don't want to overwrite the current cell value with the screen tip either,
What it is doing, is adding the root part of the hyperlink (with \True on the end) to the correct cell but then the last part of the hyperlink - from desktop\ onward to the current active cell (along with writing the screen tip to that cell).
Can anyone point out what i've got wrong?
Code:
Private Sub CommandButton3_Click()
Dim ws As Worksheet
Dim tbl As ListObject
Dim CurrentRef As String
Dim i As Integer
Set ws = Dossier
Set tbl = ws.ListObjects("Dossier")
'create hyperlink in userform
CurrentRef = txtprojectref.Value
i = Right(CurrentRef, 1)
ws.Hyperlinks.Add Anchor:=tbl.DataBodyRange(i, 1), Address:=Application.Dialogs(xlDialogInsertHyperlink).Show
End Sub
Last edited: