|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
javascript有许多函数和功能可以弥补VBA不足,如正则,数组,类,等等
1)以数组为例,用JAVASCRIPT排序
Sub fig8()
Set x = CreateObject("msscriptcontrol.scriptcontrol")
x.Language = "javascript"
arr = Array("aa", "cc", "bb", "1a")
kk = Join(arr, ",")
x.addcode "function aa(bb){x=bb.split(',');x.sort();return x;}"
cc = x.eval("aa('" & kk & "')")
MsgBox cc
End Sub
2)1)以数组为例,用JAVASCRIPT倒序
Sub fig8()
Set x = CreateObject("msscriptcontrol.scriptcontrol")
x.Language = "javascript"
arr = Array("aa", "cc", "bb", "1a")
kk = Join(arr, ",")
x.addcode "function aa(bb){x=bb.split(',');x.reverse();return x;}"
cc = x.eval("aa('" & kk & "')")
MsgBox cc
End Sub
[ 本帖最后由 figfig 于 2009-9-3 00:36 编辑 ] |
评分
-
5
查看全部评分
-
|