vb 如何获取EXCEL所有工作表名并显示在List1上
3个回答
展开全部
Private Sub Command1_Click()
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Set XLWorkBook = XlApp.Workbooks.Open(App.Path & "\1.xls")
For i = 1 To XLWorkBook.Worksheets.Count
List1.AddItem XLWorkBook.Sheets(i).Name
Next i
XlApp.Quit
End Sub
读取存储在程序所在路径的1.xls
循环取出1.xls所有的工作表明
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Set XLWorkBook = XlApp.Workbooks.Open(App.Path & "\1.xls")
For i = 1 To XLWorkBook.Worksheets.Count
List1.AddItem XLWorkBook.Sheets(i).Name
Next i
XlApp.Quit
End Sub
读取存储在程序所在路径的1.xls
循环取出1.xls所有的工作表明
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Set XLWorkBook = XlApp.Workbooks.Open(App.Path & "\1.xls")
For i = 1 To XLWorkBook.Worksheets.Count
List1.AddItem XLWorkBook.Sheets(i).Name
Next i
XlApp.Quit
End Sub
Dim XlApp As New Excel.Application
Dim XLWorkBook As New Excel.Workbook
Set XLWorkBook = XlApp.Workbooks.Open(App.Path & "\1.xls")
For i = 1 To XLWorkBook.Worksheets.Count
List1.AddItem XLWorkBook.Sheets(i).Name
Next i
XlApp.Quit
End Sub
追问
有没有用SQL语句的方法
追答
没有。
有人抄袭我的代码混分啊
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
/
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询