Excel

VBAでURLエンコード


VBAやVBSでURLで使えない文字列をエンコードする方法です。

Dim sc
Set sc = CreateObject("ScriptControl")
sc.Language = "JScript"

Dim str
str = "エンコードしたい文字列"
Dim encoded 'エンコード後の文字列
encoded = sc.CodeObject.encodeURIComponent(str)