Re: How can I copy multiple records from the Data Grid to the clipboar
From: Mark J. McGinty (mmcginty_at_spamfromyou.com)
Date: 02/19/05
- Previous message: James: "Re: ADO Shape and Subqueries"
- In reply to: Jir: "How can I copy multiple records from the Data Grid to the clipboar"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 19 Feb 2005 05:19:53 -0800
"Jir" <Jir@discussions.microsoft.com> wrote in message
news:0790314A-9366-4360-AC94-874276CA4743@microsoft.com...
> How can I copy multiple records from the Data Grid to the clipboard?
You'll have to access the rows in the recordset yourself, and copy the
values to the clipboard in a format that's understood by whatever app you'll
be pasting into. If that app happens to be Excel, delimit (separate) field
values with a tab character, and rows with a new line, e.g.,
' assumes rs is a clone of the recordset to which the grid is bound
Dim i As Long, j As Long, buf As String
If (Grid.SelBookmarks.Count > 0) Then
For i = 0 To Grid.SelBookmarks.Count - 1
rs.Bookmark = Grid.SelBookmarks(i)
buf = buf & rs.Fields(0).Value
For j = 1 To rs.Fields.Count - 1
buf = buf & vbTab & rs.Fields(j).Value
Next
buf = buf & vbCrLf
Next
End If
buf = Left(buf, Len(buf) - 2)
Clipboard.Clear
Clipboard.SetText buf
Good Luck,
Mark
- Previous message: James: "Re: ADO Shape and Subqueries"
- In reply to: Jir: "How can I copy multiple records from the Data Grid to the clipboar"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|