Public Sub SaveAsExcel(msfGrid As MSFlexGrid, strName As String, strNote() As String) Dim i As Integer Dim j As IntegerSet ExcelSheet = CreateObject("Excel.Sheet") 'ExcelSheet.Application.Visible = True With ExcelSheet For i = 0 To msfGrid.Rows - 1 For j = 0 To msfGrid.Cols - 1 .Application.Cells(i + 1, j + 1).Value = msfGrid.TextMatrix(i, j) Next Next For j = 0 To UBound(strNote) .Application.Cells(i + 1, j + 1).Value = strNote(j) Next End With
'ExcelSheet.SaveAs App.Path & "\excel\" & strName ExcelSheet.SaveAs strName ExcelSheet.Application.Quit End Sub
Dim i As Integer
Dim j As IntegerSet ExcelSheet = CreateObject("Excel.Sheet")
'ExcelSheet.Application.Visible = True
With ExcelSheet
For i = 0 To msfGrid.Rows - 1
For j = 0 To msfGrid.Cols - 1
.Application.Cells(i + 1, j + 1).Value = msfGrid.TextMatrix(i, j)
Next
Next
For j = 0 To UBound(strNote)
.Application.Cells(i + 1, j + 1).Value = strNote(j)
Next
End With
'ExcelSheet.SaveAs App.Path & "\excel\" & strName
ExcelSheet.SaveAs strName
ExcelSheet.Application.Quit
End Sub