VB6.0 把LISTBOX输入到EXCEL单元格 250
例如:LIST1里有1,2,3。把他输出到EXCLE表格并且每输入一个空一格,结果应为:A1=1,A2=空格,A3=2,A4=空格,A5=3,A6=空格LISTBOX里的...
例如:LIST1里有1,2,3。 把他输出到EXCLE表格并且每输入一个空一格,结果应为:A1 =1, A2=空格,A3 =2,A4=空格,A5 =3,A6=空格
LISTBOX里的内容条数不固定
没人会吗? 展开
LISTBOX里的内容条数不固定
没人会吗? 展开
2个回答
展开全部
可以的,等着收成品
更多追问追答
追问
?
追答
Dim myExApp As Excel.Application
Dim myExSheet As Excel.Worksheet
Dim i As Long
Dim j As Long
Set myExApp = New Excel.Application
myExApp.Visible = True
myExApp.Workbooks.Add
Set myExSheet = myExApp.Workbooks(1).Worksheets(1)
For i = 1 To ReportRecordList.ColumnCount
ReportRecordList.BoundColumn = ReportRecordList.BoundColumn + 1
For j = 1 To ReportRecordList.ListCount 'Counter for ListCount
myExSheet.Cells(j , i) = ReportRecordList.ItemData(j - 1)
myExSheet.Cells(j , i).offset(1,0) = empty
Next j
Next i
ReportRecordList.BoundColumn = 1
Set myExSheet = Nothing
Set myExApp = Nothing
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
'先引用Excel
'下面是基础代码,创建Excel对象并操作Excel表格,后面就看你自己发挥了
Dim myexcel As New Excel.Application
Dim mybook As New Excel.Workbook
Dim mysheet As New Excel.Worksheet
Set mybook = myexcel.Workbooks.Add '添加一个新的BOOK
Set mysheet = mybook.Worksheets.Add '添加一个新的SHEET
myexcel.Visible = True
myexcel.Range("a1").Select
'下面是基础代码,创建Excel对象并操作Excel表格,后面就看你自己发挥了
Dim myexcel As New Excel.Application
Dim mybook As New Excel.Workbook
Dim mysheet As New Excel.Worksheet
Set mybook = myexcel.Workbooks.Add '添加一个新的BOOK
Set mysheet = mybook.Worksheets.Add '添加一个新的SHEET
myexcel.Visible = True
myexcel.Range("a1").Select
追问
不要捣乱
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询