|
|
|
|
|
Dicas
|
|
Visual Basic (Grid/FlexGrid)
|
|
|
Título da Dica: CopiaDbGridParaClipboard
|
|
|
|
Postada em 27/6/2007 por Jailton Sampaio
jailton_sampaio@hotmail.com
Sub CopiaDbGridParaClipboard(RecSet As Recordset)
Dim TextoClip As String Dim Valor As String Dim i As Integer On Error GoTo TrataErro ' Clipboard.Clear TextoClip = "" RecSet.MoveMin For i = 0 To RecSet.Fields.Count - 1 Valor = Trim(RecSet.Fields(i).Name) TextoClip = TextoClip + Valor + ";" Next Screen.MousePointer = 11 TextoClip = Left(TextoClip, Len(TextoClip) - 1) + Chr(13) + Chr(10) While Not RecSet.EOF For i = 0 To RecSet.Fields.Count - 1 Valor = IIf(IsNull(RecSet.Fields(i)), "0", RecSet.Fields(i)) TextoClip = TextoClip + Valor + ";" Next TextoClip = Left(TextoClip, Len(TextoClip) - 1) + Chr(13) + Chr(10) RecSet.MoveNext Wend Clipboard.SetText TextoClip, vbCFText RecSet.MoveMin Screen.MousePointer = 0
TrataErro: Exit Sub End Sub
|
|
|
|
|