Created
September 8, 2017 14:17
-
-
Save cwg999/51bafc6cc5f28308ca219e0b43b1aff2 to your computer and use it in GitHub Desktop.
encodeURIComponent in VBA for Excel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function encodeURIComponent(strText As String) As String | |
Static objHtmlfile As Object | |
If objHtmlfile Is Nothing Then | |
Set objHtmlfile = CreateObject("htmlfile") | |
' objHtmlfile.parentWindow.execScript "function encode(s) {return encodeURIComponent(s)}", "jscript" | |
End If | |
encodeURIComponent = objHtmlfile.parentWindow.encodeURIComponent(strText) | |
End Function | |
Function decodeURIComponent(strText As String) As String | |
Static objHtmlfile As Object | |
If objHtmlfile Is Nothing Then | |
Set objHtmlfile = CreateObject("htmlfile") | |
' objHtmlfile.parentWindow.execScript "function encode(s) {return encodeURIComponent(s)}", "jscript" ' if you wanted to add a custom function | |
End If | |
decodeURIComponent = objHtmlfile.parentWindow.decodeURIComponent(strText) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment