VB6.0的DATAGRID数据导出EXCEL
VB6.0的DATAGRID数据导出EXCEL中为什么只显示最后一页的数据?请高手指正,代码如下:PrivateSubCommand5_Click()DimexAsObj...
VB6.0的DATAGRID数据导出EXCEL中为什么只显示最后一页的数据?请高手指正,代码如下:
Private Sub Command5_Click()
Dim ex As Object
Dim i As Integer
Dim j As Integer
Dim XlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set XlApp = CreateObject("Excel.Application")
XlApp.Visible = True
Set xlBook = XlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
For i = 0 To DataGrid1.Columns.Count
For j = 0 To DataGrid1.ApproxCount
DataGrid1.Col = i
On Error Resume Next
DataGrid1.Row = j
xlSheet.Cells(j + 1, i + 1) = DataGrid1.Columns.Item(i).Text
Next j
Next i
End Sub 展开
Private Sub Command5_Click()
Dim ex As Object
Dim i As Integer
Dim j As Integer
Dim XlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set XlApp = CreateObject("Excel.Application")
XlApp.Visible = True
Set xlBook = XlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
For i = 0 To DataGrid1.Columns.Count
For j = 0 To DataGrid1.ApproxCount
DataGrid1.Col = i
On Error Resume Next
DataGrid1.Row = j
xlSheet.Cells(j + 1, i + 1) = DataGrid1.Columns.Item(i).Text
Next j
Next i
End Sub 展开
若以下回答无法解决问题,邀请你更新回答
3个回答
展开全部
做了分页显示吗?那你的页码部分的循环在哪里?
IJ以外再加个翻页循环吧(如果有的话)。
IJ以外再加个翻页循环吧(如果有的话)。
更多追问追答
追问
分页循环怎么写?
追答
DataGrid1.ApproxCount 是不是要改为 DataGrid1.rows.Count
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
fjdlkkjgfd
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询