Public Sub Export(formname As Form, flexgridname As String) '导入到excel Dim xlApp As Object 'Excel.Application Dim xlBook As Object 'Excel.Workbook Dim xlSheet As Object 'Excel.Worksheet Screen.MousePointer = vbHourglass On Error GoTo Err_Proc Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Add Set xlSheet = xlBook.Worksheets(1) 'Begin to fill data to sheet Dim i As Long Dim j As Integer With formname.Controls(flexgridname) For i = 0 To .Rows - 1 For j = 0 To .Cols - 1 xlSheet.Cells(i + 1, j + 1).Value = "'" & .TextMatrix(i, j) Next j Next i End With xlApp.Visible = True Screen.MousePointer = vbDefault Exit Sub Err_Proc: Screen.MousePointer = vbDefault MsgBox "ÇëÈ·ÈÏÄúµÄµçÄÔÒѰ²×°Excel£¡", vbExclamation, "Ìáʾ" End Sub