请问VB 如何导出列表框(LISTBOX)数据 比如我想把listbox1里面我选中的第三项导入到EXCEL里
请问VB如何导出列表框(LISTBOX)数据比如我想把listbox1里面我选中的第三项导入到EXCEL里第一页的第一列第二行。请高人举个例子谢谢!...
请问VB 如何导出列表框(LISTBOX)数据 比如我想把listbox1里面我选中的第三项导入到EXCEL里第一页的第一列第二行。
请高人举个例子 谢谢! 展开
请高人举个例子 谢谢! 展开
展开全部
Private Sub Command1_Click()
List1.Selected(2) = True'选list1里面的中第三行
List1.SetFocus'复制选中行的数据
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Dim XLWorkSheet As New Excel.Worksheet
Set XLWorkBook = XlApp.Workbooks.Add
Set XLWorkSheet = XLWorkBook.Worksheets(1)
XlApp.Visible = True
XLWorkSheet.Cells(2, 1).Value = List1.Text'写入数据
End Sub
Private Sub Form_Load()
List1.AddItem "123456"' '将123456放进list1第一行
List1.AddItem "454678" '将454678放进list1第二行
List1.AddItem "111111"
List1.AddItem "222222"
List1.AddItem "333333"
End Sub
List1.Selected(2) = True'选list1里面的中第三行
List1.SetFocus'复制选中行的数据
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Dim XLWorkSheet As New Excel.Worksheet
Set XLWorkBook = XlApp.Workbooks.Add
Set XLWorkSheet = XLWorkBook.Worksheets(1)
XlApp.Visible = True
XLWorkSheet.Cells(2, 1).Value = List1.Text'写入数据
End Sub
Private Sub Form_Load()
List1.AddItem "123456"' '将123456放进list1第一行
List1.AddItem "454678" '将454678放进list1第二行
List1.AddItem "111111"
List1.AddItem "222222"
List1.AddItem "333333"
End Sub
展开全部
Private Sub Command1_Click()
List1.Selected(2) = True
List1.SetFocus
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Dim XLWorkSheet As New Excel.Worksheet
Set XLWorkBook = XlApp.Workbooks.Add
Set XLWorkSheet = XLWorkBook.Worksheets(1)
XlApp.Visible = True
XLWorkSheet.Cells(2, 1).Value = List1.Text
End Sub
Private Sub Form_Load()
List1.AddItem "123456"
List1.AddItem "454678"
List1.AddItem "111111"
List1.AddItem "222222"
List1.AddItem "333333"
End Sub
List1.Selected(2) = True
List1.SetFocus
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Dim XLWorkSheet As New Excel.Worksheet
Set XLWorkBook = XlApp.Workbooks.Add
Set XLWorkSheet = XLWorkBook.Worksheets(1)
XlApp.Visible = True
XLWorkSheet.Cells(2, 1).Value = List1.Text
End Sub
Private Sub Form_Load()
List1.AddItem "123456"
List1.AddItem "454678"
List1.AddItem "111111"
List1.AddItem "222222"
List1.AddItem "333333"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询