drom
Well-known Member
- Joined
- Mar 20, 2005
- Messages
- 543
- Office Version
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
Hi and thanks in advance!
I have a TXT file with some columns and many rows.
One of the columns comes with URL addresses
I have a macro who creates a report for some customers in PDF and shows this URL's as:
This works fine for every client (over 200) except for one
When I click the hyperlink I don't go anywhere.
This are some existing URL's I am not able to make then work using the above code:
URL
This are some existing URL's and working URL's using the above code (the do belong to other customer):
URL
So My problem is why the URL's belonging to my first customer (I have pasted only 2 lines, but is thesame for the other 200 url's, check blue colour ) dont work using the code, and works when doing manually, copy-paste
And for avery other customer the same code always works
Thanks gain!
I have a TXT file with some columns and many rows.
One of the columns comes with URL addresses
I have a macro who creates a report for some customers in PDF and shows this URL's as:
- URL 001
- URL 002
- URL 003
This works fine for every client (over 200) except for one
When I click the hyperlink I don't go anywhere.
- But if I copy the HyperLink address and I paste-it within google chrome and/or internet explorer the URL exists and works fine
VBA Code:
Dim rcCOL As Range: Set rcCOL = Range("rcURL")
For Each rCell In rcCOL
If rCell <> "" Then
X = X + 1
rCell.Hyperlinks.Add Anchor:=rCell, Address:=rCell, TextToDisplay:="URL " & Format(X, "000")
'rcRowDataURL.Cells(xRow).Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula ' aURL(xRow, 1) = ""
End If
Next rCell
This are some existing URL's I am not able to make then work using the above code:
URL
This are some existing URL's and working URL's using the above code (the do belong to other customer):
URL
So My problem is why the URL's belonging to my first customer (I have pasted only 2 lines, but is thesame for the other 200 url's, check blue colour ) dont work using the code, and works when doing manually, copy-paste
And for avery other customer the same code always works
Thanks gain!
VBA Code:
Sub WorkingURLeg()
Dim wURL As String: wURL = ActiveCell
'WORKS
'wURL = "https://www.netrivals.com/es/redirect-to?re=1&store-redirect-url=YUhSMGNITTZMeTkzeFZiZDNjdVoyOXZaMnhsTG1WekwyRmpiR3MvYzJFOVRDWmhhVDFFUTJoalUwVjNhVmd5YzBNNGNVeHFlVUZvV0doSlN6QkhTR1I1WDBOT01GbEJRa0ZSUjJkS2QyUm5Kbk5wWnoxQlQwUTJORjh4UjBjd1NrOHhVbFpaYUVKRGQyOU1hV2xQZFhSb1YybHpSV2RuSm1OMGVYQmxQVFVtY1QwbWRtVmtQVEJoYUZWTFJYZHBiSFp5TmpoeFRHcDVRV2hZVVVkNlVVbElWRUpXUkZvd1VURnBhMGxNUVNaaFpIVnliRDA9"
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=wURL, TextToDisplay:="URL01"
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub
VBA Code:
Sub NonWorkingURLeg()
On Error Resume Next 'MANDATORY with this URL's
' Macro4 Macro
Dim wURL As String: wURL = ActiveCell
'WORKS when copy-Paste on internet but now when using this macro
'wURL = "https://www.netrivals.com/es/redirect-to?re=1&store-redirect-url=YUhSMGNITTZMeTkzeFZiZDNjdVptRnliV0YyWVhweGRXVjZMbU52YlM5eVpXZGhiRzh0ZG1samFIa3RjSEp2ZEc5amIyeHZMV052Ym5SeVlTMXNiM010WldabFkzUnZjeTFrWlMxc1lTMXlZV1JwWVdOcGIyNHRkV3gwY21GMmFXOXNaWFJoTFRZeE1qQTJNeTVvZEcxcw=="
'wURL= "https://www.netrivals.com/es/redirect-to?re=1&store-redirect-url=YUhSMGNITTZMeTkzeFZiZDNjdVptRnliV0YyWVhweGRXVjZMbU52YlM5b1pXeHBiMk5oY21VdE16WXdMWGRoZEdWeUxXZGxiQzF6Y0dZMU1DMDFNQzF0YkMwMk1ESTNOekV1YUhSdGJBPT0="
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=wURL, TextToDisplay:="URL01"
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub