一、如何把vb中算出来的数据导入到excel
没看你的程序
给你提供点参考
有问题留言
set e = CreateObject("Excel.Application")
e.visible = 0
set nb = e.workbooks.add
set ns = nb.worksheets(1)
for i = 1 to 10
for j = 1 to 10
ns.cells(i,j) = cstr(i) & "," & cstr(j)
next
next
ns.saveas "c:a.xlsx"
e.quit
set e = CreateObject("Excel.Application")
e.visible = 0
set nb = e.workbooks.add
set ns = nb.worksheets(1)
for i = 1 to 10
for j = 97 to 105
k = chr(j)
ns.range(k&i).value = "第"&i&"个"
next:next
ns.saveas "c:a.xls"
e.quit
二、怎样在vb中导入excel表格数据
一个按钮,五个文本框(文本框用复制方式)
dim
xlsapp
as
excel.application
dim
xlsbook
as
excel.workbook
dim
xlssheet
as
excel.worksheet
set
xlsapp
=
new
excel.application
set
xlsbook
=
xlsapp.workbooks.add
set
xlssheet
=
xlsbook.worksheets(1)
xlssheet.application.columns("a:l").numberformatlocal
=
"@"
'文本格式为通用
xlssheet.cells.horizontalalignment
=
xlcenter
'文本居中
xlssheet.columns("a:l").columnwidth
=
5
'调整列宽(从a列到l列
dim
i
as
integer
for
i
=
0
to
4
xlssheet.cells(
2,
i+
1)
=
text1(i).text
next
i
xlsapp.visible
=
true
set
xlsapp
=
nothing
自己可以研究一下上面的代码(其中文本框用复制做数组)