How do I use more than 255 characters in Excel\'s CONCATENATE function? I am actually also using the CONCATENATE function within the HYPERLINK function in EXCEL. An example
Here's some VBA which uses bitly.com to shorten a URL. It is based on the bitly API documentation.
Public Function GetURL(longUrl As String) As String Dim xml As Object longUrl = URLEncode(longUrl) Set xml = CreateObject("MSXML2.XMLHTTP.6.0") xml.Open "GET", "https://api-ssl.bitly.com/v3/shorten?format=xml&access_token=MY_TOKEN=" & longUrl, False xml.Send GetURL = xml.responsetext head = InStr(GetURL, "
") + 5 tail = InStr(GetURL, " ") GetURL = Mid(GetURL, head, tail - head) End Function Function URLEncode(ByVal Text As String) As String Dim i As Integer Dim acode As Integer Dim char As String URLEncode = Text For i = Len(URLEncode) To 1 Step -1 acode = Asc(Mid$(URLEncode, i, 1)) Select Case acode Case 48 To 57, 65 To 90, 97 To 122 ' don't touch alphanumeric chars Case 32 ' replace space with "+" Mid$(URLEncode, i, 1) = "+" Case Else ' replace punctuation chars with "%hex" URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$(URLEncode, i + 1) End Select Next End Function