vba 执行js代码

Sub sample()
Dim code
code = "function greeting(x){return 'hello ,'+x}"
Set js = CreateObject("ScriptControl")
js.Language = "JScript"
js.AddCode code
Debug.Print js.Run("greeting", "Jack")

End Sub

 

posted @ 2022-02-13 16:39  今天起个早  阅读(625)  评论(0编辑  收藏  举报