请问如何在vs2010中用vb创建一个excel文件?

2024-12-17 03:00:07
推荐回答(3个)
回答1:

VS 软件太大,我没有安装 ,VB6中是可以的,供参考
Dim objExcel As Excel.Application
Dim objWorkBook As Excel.Workbook

Set objExcel = CreateObject("Excel.Application")
Set objWorkBook = objExcel.Workbooks.Add()
objExcel.Visible = False

Dim objSheet As Excel.Worksheet
Set objSheet = objExcel.Worksheets("sheet1")
objSheet.Cells(1,1) = "姓名" '对单元格赋值
objSheet.Cells(1,2) = Date
objSheet.Cells(1,3) = Time
objWorkBook.SaveAs App.Path & "\a.xls" '保存
objWorkBook.Close
objExcel.Quit
Set objSheet = Nothing
Set objWorkBook = Nothing
Set objExcel = Nothing

回答2:

no

回答3:

kjsafs