数组vb"/>
mysql二维数组vb
首先建立一个JS脚本文件,并保存为helloworld.wsc
脚本内容如下:
Function CreateVBArray(excel,y,z)
Dim i,j,a,b
Dim strArr()
a=y
b=z
redim strArr(a,b)
For i=0 to y
For j=0 to z
strArr(i,j) = 5
Next
Next
scol = GetCellColumnNumber( z )
excel.range("a1:" + scol + CStr(y) ) = strArr
End Function
'下面这个函数是转化EXCEL列数字为字母,譬如 27 = "AA"列
Function GetCellColumnNumber(iColumnCount)
iColumnCount = iColumnCount - 1
If iColumnCount < 26 Then
GetCellColumnNumber = Chr(iColumnCount + Asc("A"))
Else
GetCellColumnNumber = Chr(iColumnCount / 26 - 1 + Asc("A")) + Chr(iColumnCount Mod 26 + Asc("A"))
End If
End Function
//保存文件之后,右击文件并点击注册!注册成功之后该脚本已经做为一个组件注册到系统中!
接下来说说PB对它的调用//
OleObject JsComponent
JsComponent = create OleObject
li_conn = JsComponent.connecttonewobject( "hello.world" )
If li_conn = 0 Then
Jscomponent.CreateVBArray( excel,5,53 )
End If
很简单吧 PB就这么实现了动态二维数组粘贴excel区域的操作
总结
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250
更多推荐
mysql二维数组vb
发布评论