VB从excel读取数据赋值给一个列表框怎么实现? 25
展开全部
1,用VB打开Excel,如
Dim appExcel As Object
Dim wbkName As Object
Dim shtName As Object
Dim strSavePath As String
Dim strRead as string
'Create the Excel file
10 Set appExcel = CreateObjec("Excel.Application")
20 Set wbkName = appExcel.workbooks.Add
30 Set shtName = wbkName.worksheets(1)
40 wbkName.worksheets(1).Name = "Sheet1"
50 strRead =appExcel.Range("A1").Value
60 wbkName.Save
70 appExcel.quit
2,赋值给一个列表框,可以用LIST1.ADDITEM strRead,再赋值给另一个窗体的列表框,用窗体名称.列表框名称.ADDITEM strRead
Dim appExcel As Object
Dim wbkName As Object
Dim shtName As Object
Dim strSavePath As String
Dim strRead as string
'Create the Excel file
10 Set appExcel = CreateObjec("Excel.Application")
20 Set wbkName = appExcel.workbooks.Add
30 Set shtName = wbkName.worksheets(1)
40 wbkName.worksheets(1).Name = "Sheet1"
50 strRead =appExcel.Range("A1").Value
60 wbkName.Save
70 appExcel.quit
2,赋值给一个列表框,可以用LIST1.ADDITEM strRead,再赋值给另一个窗体的列表框,用窗体名称.列表框名称.ADDITEM strRead
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |