怎样在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
自己可以研究一下上面的代码(其中文本框用复制做数组)
温馨提示:答案为网友推荐,仅供参考
相似回答
大家正在搜