+ Reply to Thread
Results 1 to 2 of 2

base64 encoding??? in a hyperlink more less..

Hybrid View

  1. #1
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: base64 encoding??? in a hyperlink more less..

    see: http://stackoverflow.com/questions/1...sing-excel-vba

    Revised to Late Binding approach this becomes:

    Function EncodeBase64(text As String) As String
      Dim arrData() As Byte
      arrData = StrConv(text, vbFromUnicode)
    
      Dim objXML
      Dim objNode
    
      Set objXML = CreateObject("MSXML2.DOMDocument")
      Set objNode = objXML.createElement("b64")
    
      objNode.DataType = "bin.base64"
      objNode.nodeTypedValue = arrData
      EncodeBase64 = objNode.text
    
      Set objNode = Nothing
      Set objXML = Nothing
    End Function
    So if your string is in A2 you would use

    =ENCODEBASE64(A2)
    (obviously remove the = if you wish to embed within another formula - eg ="Apples: "&ENCODEBASE64(A2)&", Pears"

    Does that work for you ?


    EDIT: to add - the above is a UDF - ie VBA code that should be placed in a stand alone Module - thereafter Macros must be enabled
    Last edited by DonkeyOte; 12-11-2009 at 02:12 PM.

+ 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