Export an msFlexGrid to an excel spreadsheet
Export an msFlexGrid to an excel spreadsheet
Rate Export an msFlexGrid to an excel spreadsheet
(1(1 Vote))
Dim appExcel As Excel.Application
Dim wrkExcel As Excel.Workbook
Dim shtExcel As Excel.Worksheet
Dim intNewSheets As Integer
Dim llRow As Long
Dim llCol As Long
On Error Resume Next
Set appExcel = GetObject(, "Excel.Application")
If appExcel Is Nothing Then
Set appExcel = CreateObject("Excel.Application")
If appExcel Is Nothing Then
MsgBox "Cannot Open Microsoft Excel For Export", vbCritical
Exit Sub
End If
End If
intNewSheets = appExcel.SheetsInNewWorkbook
appExcel.SheetsInNewWorkbook = 1
Set wrkExcel = appExcel.Workbooks.Add
appExcel.SheetsInNewWorkbook = intNewSheets
Set shtExcel = wrkExcel.Sheets(1)
With shtExcel
For llRow = 0 To aoFG.Rows - 1
For llCol = 0 To aoFG.Cols - 1
shtExcel.Cells(llRow + 1, llCol + 1).Value = aoFG.TextMatrix(llRow, llCol)
Next
Next
End With
shtExcel.Range("A1").Select
appExcel.DisplayFullScreen = True
appExcel.DisplayFullScreen = False
appExcel.Visible = True
Set shtExcel = Nothing
Set wrkExcel = Nothing
Set appExcel = Nothing
End Sub
Export an msFlexGrid to an excel spreadsheet Comments
No comments yet — be the first to post one!
Post a Comment