vbs把数组导到Excel中

最近做框架的时候,遇到一个问题,要把Array中的数据导出到Excel中去。

Implementation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
dim arr(10,5)  
for i=0 to 10
for j = 0 to 5
arr(i,j)=i*j
next
next

set excel = CreateObject("Excel.Application")
excel.Visible = true
set oWB = excel.Workbooks.Add
set oSheet = oWB.ActiveSheet
set xlsheet = oWB.Worksheets(1)
for i=oWB.Worksheets.count to 2 step -1
oWB.Worksheets(i).Delete()
next
oSheet.Range("a1").resize(10,5)=arr
set excel=nothing

Result

Execute Result

唐胡璐 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
分享创造价值,您的支持将鼓励我继续前行!