You are on page 1of 1

Private Sub Command1_Click()

exportar msfg1
End Sub
Sub exportar(MS As MSFlexGrid)
On Error GoTo ExCepcion
Dim pt As Boolean
Dim xl As New excel.Application, i%, J%
If MS.Rows >= 3 Then
Screen.MousePointer = vbHourglass
xl.Workbooks.Add
For i = 0 To MS.Rows - 1
For J = 0 To MS.Cols - 1
xl.Cells(i + 7, J + 1) = MS.TextMatrix(i, J)
Next
Next
xl.ActiveWindow.Zoom = 75
xl.Application.WindowState = xlMaximized
xl.Visible = True
Set xl = Nothing
Screen.MousePointer = vbDefault
Else
MsgBox "No Hay Datos que Exportar", 16, "Mensaje"
End If
Exit Sub
ExCepcion:
Set xl = Nothing
MsgBox "Error al Exportar Los Datos A Excel " & Err.Description, 16, "Error
en el Componente"
Screen.MousePointer = vbDefault
End Sub

You might also like