vb将textbox导出到excel
我用的是vb6textbox中有如下格式的内容班名号分数详细1a110ADC1b215DAC以空格为换行标志,然后导出到excel中...
我用的是vb6
textbox中有如下格式的内容
班 名 号 分数 详细
1 a 1 10 A D C
1 b 2 15 D A C
以空格为换行标志,然后导出到excel中 展开
textbox中有如下格式的内容
班 名 号 分数 详细
1 a 1 10 A D C
1 b 2 15 D A C
以空格为换行标志,然后导出到excel中 展开
2013-11-08
展开全部
分割函数 然后 x=split(s," ") ,s为一条记录 Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1) for i=0 to ubound(x) xlSheet(1,i+1)=x(i) next
xlApp.ActiveWorkbook.SaveAs "D:\1.xls" xlApp.Visible = False
xlBook.Close (True) '关闭工作簿
xlApp.Quit '结束EXCEL对象
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing '释放xlApp对象
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1) for i=0 to ubound(x) xlSheet(1,i+1)=x(i) next
xlApp.ActiveWorkbook.SaveAs "D:\1.xls" xlApp.Visible = False
xlBook.Close (True) '关闭工作簿
xlApp.Quit '结束EXCEL对象
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing '释放xlApp对象
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim app As New Excel.Application'定义app为Excel应用程序
Dim book As Excel.Workbook'定义book为的工作簿
Dim sheet As Excel.Worksheet’定义sheet为的工作表
Private Sub Command1_Click()'点击command1按钮实现导入
Set book = app.Workbooks.Add'新建book
Set sheet = book.Sheets(1)'新建sheets(1)
sheet.Range("A1").Value = Text1.Text'sheets(1)中A1赋值为text1内容
sheet.Range("B1").Value = Text2.Text'sheets(1)中B1赋值为text2内容
End Sub
Dim book As Excel.Workbook'定义book为的工作簿
Dim sheet As Excel.Worksheet’定义sheet为的工作表
Private Sub Command1_Click()'点击command1按钮实现导入
Set book = app.Workbooks.Add'新建book
Set sheet = book.Sheets(1)'新建sheets(1)
sheet.Range("A1").Value = Text1.Text'sheets(1)中A1赋值为text1内容
sheet.Range("B1").Value = Text2.Text'sheets(1)中B1赋值为text2内容
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
分割函数 然后 x=split(s," ") ,s为一条记录 Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1) for i=0 to ubound(x) xlSheet(1,i+1)=x(i) next
xlApp.ActiveWorkbook.SaveAs "D:\1.xls" xlApp.Visible = False
xlBook.Close (True) '关闭工作簿
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1) for i=0 to ubound(x) xlSheet(1,i+1)=x(i) next
xlApp.ActiveWorkbook.SaveAs "D:\1.xls" xlApp.Visible = False
xlBook.Close (True) '关闭工作簿
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |