Hyperlink edited by code

andy1968

Registered User.
Local time
Today, 13:00
Joined
May 9, 2018
Messages
131
I am trying to modify a hyperlink based on user input from a form.


I want to add a date from a text box to the end of a url.


Here is the code:



Code:
Private Sub Weather_DblClick(Cancel As Integer)
Dim strLink As String
Dim strDate As String
strDate = Format(Me.DateOfReport, "yyyy-mm-dd")
strLink = Mid(Me.Contract_.Column(3), 2, Len(Me.Contract_.Column(3)) - 2) & strDate
Application.FollowHyperlink (strLink), , True
End Sub
I get this result:


https://www.wunderground.com/histor...date/2018-10-19FirefoxHTML\Shell\Open\Command


But I want this:


https://www.wunderground.com/history/daily/us/ca/san-carlos/KSQL/date/2018-10-19


This is what is in Contract_.Column(3):


https://www.wunderground.com/history/daily/us/ca/san-carlos/KSQL/date/


Any ideas?
 
is column(3) a Real hyperlink field?

if so, hyperlinks have two parts.
the first part is the text that is being displayed.
the second part is the actual link.

use split() function to get the secondpart and add the Date there:
Code:
Private Sub Weather_DblClick(Cancel As Integer)
Dim strLink As String
Dim strDate As String
strDate = Format(Me.DateOfReport, "yyyy-mm-dd")
strLink = Split(Me.Contract_.Column(3), "#")(1) & strDate
Application.FollowHyperlink (strLink), , True
End Sub
 
I cannot see how the code

Code:
strLink = Mid(Me.Contract_.Column(3), 2, Len(Me.Contract_.Column(3)) - 2) & strDate

gives you what you say you get ?:confused:

I am trying to modify a hyperlink based on user input from a form.


I want to add a date from a text box to the end of a url.


Here is the code:



Code:
Private Sub Weather_DblClick(Cancel As Integer)
Dim strLink As String
Dim strDate As String
strDate = Format(Me.DateOfReport, "yyyy-mm-dd")
strLink = Mid(Me.Contract_.Column(3), 2, Len(Me.Contract_.Column(3)) - 2) & strDate
Application.FollowHyperlink (strLink), , True
End Sub
I get this result:


https://www.wunderground.com/histor...date/2018-10-19FirefoxHTML\Shell\Open\Command


But I want this:


https://www.wunderground.com/history/daily/us/ca/san-carlos/KSQL/date/2018-10-19


This is what is in Contract_.Column(3):


https://www.wunderground.com/history/daily/us/ca/san-carlos/KSQL/date/


Any ideas?
 

Users who are viewing this thread

Back
Top Bottom