vb6.0中datagrid导出excel数据设置文本格式 30
PrivateSubCommand1_Click()DimexAsObjectDimiAsIntegerDimjAsIntegerDimXlAppAsExcel.Appl...
Private Sub Command1_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 用户_进口Grid.Columns.Count - 1
For j = 0 To 用户_进口Grid.ApproxCount - 1
用户_进口Grid.Col = i
On Error Resume Next
用户_进口Grid.Row = j
xlSheet.Cells(j + 1, i + 1) = 用户_进口Grid.Columns.Item(i).Text
Next j
Next i
End Sub
输出到excel以文本格式显示,谢谢! 展开
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 用户_进口Grid.Columns.Count - 1
For j = 0 To 用户_进口Grid.ApproxCount - 1
用户_进口Grid.Col = i
On Error Resume Next
用户_进口Grid.Row = j
xlSheet.Cells(j + 1, i + 1) = 用户_进口Grid.Columns.Item(i).Text
Next j
Next i
End Sub
输出到excel以文本格式显示,谢谢! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询