+ Reply to Thread
Results 1 to 5 of 5

excel encodes url

Hybrid View

oleg mirzaev excel encodes url 08-21-2014, 04:08 AM
Aaron092 Re: excel encodes url 08-21-2014, 04:20 AM
oleg mirzaev Re: excel encodes url 08-21-2014, 04:29 AM
Aaron092 Re: excel encodes url 08-21-2014, 04:39 AM
oleg mirzaev Re: excel encodes url 08-25-2014, 01:59 AM
  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    london
    MS-Off Ver
    Excel 2013
    Posts
    21

    excel encodes url

    Hi all,
    I used this VBA in order to put URL in PivotTable:

    https://www.youtube.com/watch?v=38wRYPEpJxY

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        Dim selPF As PivotField
        Dim strField As String
        
        strField = "link"
        
        On Error Resume Next
        Set selPF = Target.PivotField
        If Not selPF Is Nothing Then
            If selPF.Name = strField Then
                ThisWorkbook.FollowHyperlink _
                Address:=Target.Value, NewWindow:=True
            End If
        End If
    End Sub
    the problem is that in some version, excel changes "#" to "%20-%20", thus the URL is not correct and causing an error.

    Any thoughts why?

    Thanks.

  2. #2
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: excel encodes url

    Have you tried setting strField as a value instead?

    And where abouts is the hash in question?

  3. #3
    Registered User
    Join Date
    07-24-2013
    Location
    london
    MS-Off Ver
    Excel 2013
    Posts
    21

    Re: excel encodes url

    strField is just the name of a field that contains the URL (not the URL itself)...
    sorry, didn't understand the hash question.

  4. #4
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: excel encodes url

    You said that the hash (#) is being changed to "%20-%20" - where is the hash coming from that's changing to %20-%20?
    I thought it might have been in the URL.

    Using strField = Value will copy everything in the cell as is. If it's the URL causing the issue, it should help if not fix

    Would you be able to post an example?

  5. #5
    Registered User
    Join Date
    07-24-2013
    Location
    london
    MS-Off Ver
    Excel 2013
    Posts
    21

    Re: excel encodes url

    sorry for the delay...
    i can't provide the code, it's classified information
    i'm getting the values from DataBase via SQL server. the Data is ok and appear like correct "#"
    when when you click it changes in the browser.

    i still don't understand your suggestion to use Value. can you change it in the code i provided?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1