Nombre: Copiar MSFlexGrid al Portapapeles
Descripción:
Hola a todos. un saludo... Este codigo es para subir el contenido de una grilla al Portapeles con formato de excel. solo tienes k cambiar el nombre a tu grilla a MSG y copias el codigo a un boton cualquiera. Cualquier duda
torresvisual@hotmail.com Dim X1 As Integer Dim Y1 As Integer Dim X2 As Integer Dim Y2 As Integer Dim Cadena As String Cadena = "" X1 = 1 Y1 = X1 X2 = MSG.Cols Y2 = MSG.Rows If MSG.Rows > 1 Then MSG.Col = X1 MSG.Row = Y1 Cadena = MSG.Text X1 = 2 Else Cadena = "Error. NO HAY REGISTROS ACTIVOS" End If While Y1 < Y2 While X1 < X2 MSG.Col = X1 MSG.Row = Y1 If X1 = 1 Then Cadena = Cadena & Chr(13) & MSG.Text Else Cadena = Cadena & Chr(9) & MSG.Text End If X1 = X1 + 1 Wend X1 = 1 Y1 = Y1 + 1 Wend Clipboard.Clear Clipboard.SetText Cadena
URL: http://www.mygnet.net/codigos/vb/efectos_y_filtros/copiar_msflexgrid_al_portapapeles.1465
Código Fuente:
Dim X1 As Integer
Dim Y1 As Integer
Dim X2 As Integer
Dim Y2 As Integer
Dim Cadena As String
Cadena = ""
X1 = 1
Y1 = X1
X2 = MSG.Cols
Y2 = MSG.Rows
If MSG.Rows > 1 Then
MSG.Col = X1
MSG.Row = Y1
Cadena = MSG.Text
X1 = 2
Else
Cadena = "Error. NO HAY REGISTROS ACTIVOS"
End If
While Y1 < Y2
While X1 < X2
MSG.Col = X1
MSG.Row = Y1
If X1 = 1 Then
Cadena = Cadena & Chr(13) & MSG.Text
Else
Cadena = Cadena & Chr(9) & MSG.Text
End If
X1 = X1 + 1
Wend
X1 = 1
Y1 = Y1 + 1
Wend
Clipboard.Clear
Clipboard.SetText Cadena