Mensaje enviado por M. Alejandro Esteban Sánchez <maesteban@gruposp.com>
Para Copiar un Mshflexgrid al portapapeles:
Public Sub CopiaFlex(Miflex As MSHFlexgrid, blnTodo As Boolean, Optional xIni As Long, Optional xFin As Long, Optional yIni As Long,
Optional yFin As Long)
Dim r As Long
Dim c As Long
Dim ct As Long
Dim rt As Long
Dim ci As Long
Dim ri As Long
Dim str As String
With Miflex
If blnTodo = True Then
ci = 0
ri = 0
ct = .Cols - 1
rt = .Rows - 1
Else
ci = yIni
ri = xIni
ct = yFin
rt = xFin
End If
For r = ri To rt
For c = ci To ct
str = str & .TextMatrix(r, c)
If c <> ct Then str = str & vbTab
Next c
str = str & vbCr
Next r
End With
Clipboard.Clear
Clipboard.SetText str, 1
End Sub
====================================================
=====================================================
===================================================
Para Exportar a excel
Public Sub ExcelSuperioresCompro3()
Dim XlsApl As Excel.Application
Dim xlsLibro As Excel.Workbook
Dim y As Long
MiRespuesta = MsgBox("¿Desea Exportar a Excel el Listado seleccionado?", vbYesNoCancel + vbQuestion)
If MiRespuesta <> vbYes Then Exit Sub
Screen.MousePointer = 11
Set XlsApl = New Excel.Application
With XlsApl
.Workbooks.Add
Set xlsLibro = .ActiveWorkbook
With xlsLibro.Worksheets(1)
.Activate
For x = 0 To MSHFsupEnvios.Rows - 1
For y = 1 To MSHFsupEnvios.Cols
.Cells(x + 1, y) = MSHFsupEnvios.TextMatrix(x, y - 1)
End If
Next y
Next x
End With
.Visible = True
End With
Set xlsLibro = Nothing
Set XlsApl = Nothing
Screen.MousePointer = 0
End Sub