robot said:
I am try to find a VBA command that does the same thing as the JavaScript
function encodeURI(). Naturally I searched the internet, but without
success. Any help would be appreciated.
I'm not familiar with encodeURI(), but I'd have to guess it does something similar
to this:
Private Declare Function UrlEscape Lib "Shlwapi.dll" Alias "UrlEscapeA" (ByVal
pszURL As String, ByVal pszEscaped As String, ByRef pcchEscaped As Long, ByVal
dwFlags As Long) As Long
Private Const URL_DONT_ESCAPE_EXTRA_INFO As Long = &H2000000
Private Function EscapeURL(ByVal URL As String) As String
' Purpose: A thin wrapper for the URLEscape API function.
Dim EscTxt As String
Dim nLen As Long
' Create a maximum sized buffer.
nLen = Len(URL) * 3
EscTxt = Space$(nLen)
If UrlEscape(URL, EscTxt, nLen, URL_DONT_ESCAPE_EXTRA_INFO) = 0 Then
EscapeURL = Left$(EscTxt, nLen)
End If
End Function
(The above was indented to highlight wordwrap.)