Keep a hyperlink in a userform
emarie3680
Posted messages
139
Status
Member
-
emarie3680 Posted messages 139 Status Member -
emarie3680 Posted messages 139 Status Member -
Hello everyone,
I have a fairly large database of records, procedures, and protocols.
In my Excel file, this information is classified by theme, update date... and a direct access to the relevant record via a hyperlink (the records, in Word format, are stored on a server, there are over 250 of them).
To facilitate searches in this database, I created a form that allows, once the theme of the record is chosen from a dropdown menu, to display its information.
The issue is that I "lose" my hyperlink between my database in table form and my form.
Here is an excerpt from my database:
https://onedrive.live.com/redir?resid=83CBA75779CF0087!75609&authkey=!AB0MJFEWphRGSfI&e=jHE7Mr
The hyperlinks are in column G, the Record column
Here is my form:
https://onedrive.live.com/redir?resid=83CBA75779CF0087!75610&authkey=!APx_k9CKMYP-HCc&e=29OD3s
Here is the code for my form:
Private Sub CommandButton1_Click()
'double click on the Search button
If Not ComboBox1.Value = "" Then
Dim no_ligne As Integer
no_ligne = ComboBox1.ListIndex + 2
TextBox1.Value = Cells(no_ligne, 2).Value
ComboBox1.Value = Cells(no_ligne, 1).Value
TextBox2.Value = Cells(no_ligne, 3).Value
TextBox3.Value = Cells(no_ligne, 4).Value
TextBox4.Value = Cells(no_ligne, 5).Value
TextBox5.Value = Cells(no_ligne, 6).Value
TextBox6.Value = Cells(no_ligne, 7).Value
Else
End If
End Sub
The TextBox6 corresponds to my data from column G, the Record column. This is where the reference of the record is displayed, but I no longer have the hyperlink that would allow me direct access from my form.
Could you help me if a solution exists?
Thank you in advance,
Éric
Configuration: Athlon XP 3800+
I have a fairly large database of records, procedures, and protocols.
In my Excel file, this information is classified by theme, update date... and a direct access to the relevant record via a hyperlink (the records, in Word format, are stored on a server, there are over 250 of them).
To facilitate searches in this database, I created a form that allows, once the theme of the record is chosen from a dropdown menu, to display its information.
The issue is that I "lose" my hyperlink between my database in table form and my form.
Here is an excerpt from my database:
https://onedrive.live.com/redir?resid=83CBA75779CF0087!75609&authkey=!AB0MJFEWphRGSfI&e=jHE7Mr
The hyperlinks are in column G, the Record column
Here is my form:
https://onedrive.live.com/redir?resid=83CBA75779CF0087!75610&authkey=!APx_k9CKMYP-HCc&e=29OD3s
Here is the code for my form:
Private Sub CommandButton1_Click()
'double click on the Search button
If Not ComboBox1.Value = "" Then
Dim no_ligne As Integer
no_ligne = ComboBox1.ListIndex + 2
TextBox1.Value = Cells(no_ligne, 2).Value
ComboBox1.Value = Cells(no_ligne, 1).Value
TextBox2.Value = Cells(no_ligne, 3).Value
TextBox3.Value = Cells(no_ligne, 4).Value
TextBox4.Value = Cells(no_ligne, 5).Value
TextBox5.Value = Cells(no_ligne, 6).Value
TextBox6.Value = Cells(no_ligne, 7).Value
Else
End If
End Sub
The TextBox6 corresponds to my data from column G, the Record column. This is where the reference of the record is displayed, but I no longer have the hyperlink that would allow me direct access from my form.
Could you help me if a solution exists?
Thank you in advance,
Éric
Configuration: Athlon XP 3800+
4 answers
Hello
Provided that the hyperlink has the same name as that displayed in the textbox, a double-click procedure in the textbox can open the link in a new window
Best regards
Via
--
"Imagination is more important than knowledge." A. Einstein
Provided that the hyperlink has the same name as that displayed in the textbox, a double-click procedure in the textbox can open the link in a new window
Private Sub TextBox6_DblClick(ByVal Cancel As MSForms.ReturnBoolean) lien = "..\..\.....l\" & Me.TextBox6 & ".docx" ' replace ... with the file path ActiveWorkbook.FollowHyperlink Address:=lien, NewWindow:=True End Sub
Best regards
Via
--
"Imagination is more important than knowledge." A. Einstein
Thank you for your help.
However, I don't understand the process because I have as many links as there are records. My Excel file has more than 200 rows, so more than 200 record references, which means more than 200 links...?
However, I don't understand the process because I have as many links as there are records. My Excel file has more than 200 rows, so more than 200 record references, which means more than 200 links...?