How can I URL encode a string in Excel VBA?

后端 未结 15 1952
闹比i
闹比i 2020-11-22 11:39

Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality?

15条回答
  •  有刺的猬
    2020-11-22 12:07

    If you also want it to work on MacOs create a seperate function

    Function macUriEncode(value As String) As String
    
        Dim script As String
        script = "do shell script " & """/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' """ & Chr(38) & " quoted form of """ & value & """"
    
        macUriEncode = MacScript(script)
    
    End Function
    

提交回复
热议问题