accessing clipboard using vb 6.0 
Author Message
 accessing clipboard using vb 6.0

i (computer geek but newbie programmer) am trying to write a simple program
which accesses
data from another application via DDE link.  the problem is that some of the
data is saved to the clipboard by the other application, and i need to be
able to access it, including the ability to
access the individual rows separately. (i'm sure the last part could be
easily worked
around if that wasn't possible)

the format of the clipboard data will never change, just the values.  a
sample, in it's entirety,  is:

01 APR01 04/21/01 100 100 40.000000 79.139999 40
02 MAY01 05/19/01 100 100 40.000000 79.139999 145
03 JUL01 07/21/01 100 100 40.000000 79.139999 235
04 OCT01 10/20/01 100 100 40.000000 79.139999 330
05 JAN02 01/19/02 150 100 40.000000 79.139999 593
06 JAN02 01/19/02 100 100 40.000000 79.139999 430
07 JAN03 01/18/03 100 100 40.000000 79.139999 699

would anyone be able to help me access this clipboard data and pull them
into my application?



Mon, 29 Sep 2003 21:19:43 GMT  
 accessing clipboard using vb 6.0
This should do it:

'This function returns a string array
Private Function LoadFromClipboard() As String()

Dim sText As String
Dim sRows() As String    'Array

    'Get the data, if any
    If Clipboard.GetFormat(vbCFText) Then
        sText = Clipboard.GetText(vbCFText)
    End If

    'Assuming the rows have CR/LF
    'this will split them into an array, if
    'not then the entire string will be
    'returned in array element (0)
    sRows = Split(sText, vbCrLf)
    LoadFromClipboard = sRows

End Function

'Sample of calling the function:
Private Sub Command1_Click()

Dim lIdx As Long
Dim sTextRows() As String    'Array

    'Call the function to get the clipboard text
    sTextRows = LoadFromClipboard()

    'Loop through the returned array
    For lIdx = LBound(sTextRows) To UBound(sTextRows)
        'Print them to the debug window,
        'for now just to see the results.
        Debug.Print sTextRows(lIdx)
    Next

End Sub

Hope this helps,

Rocky Clark (Kath-Rock Software)


Quote:
> i (computer geek but newbie programmer) am trying to write a simple
program
> which accesses
> data from another application via DDE link.  the problem is that some of
the
> data is saved to the clipboard by the other application, and i need to be
> able to access it, including the ability to
> access the individual rows separately. (i'm sure the last part could be
> easily worked
> around if that wasn't possible)

> the format of the clipboard data will never change, just the values.  a
> sample, in it's entirety,  is:

> 01 APR01 04/21/01 100 100 40.000000 79.139999 40
> 02 MAY01 05/19/01 100 100 40.000000 79.139999 145
> 03 JUL01 07/21/01 100 100 40.000000 79.139999 235
> 04 OCT01 10/20/01 100 100 40.000000 79.139999 330
> 05 JAN02 01/19/02 150 100 40.000000 79.139999 593
> 06 JAN02 01/19/02 100 100 40.000000 79.139999 430
> 07 JAN03 01/18/03 100 100 40.000000 79.139999 699

> would anyone be able to help me access this clipboard data and pull them
> into my application?



Tue, 30 Sep 2003 00:30:27 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Accessing Access DB with password using VB 6.0

2. Accessing Access DB with password using VB 6.0

3. Accessing Access DB with password using VB 6.0

4. Using Access Database in VB 6.0

5. Using Access Database in VB 6.0

6. Web App Using ASP, Vb 6.0, ADO, and Access

7. Accessing FoxPro using VB 6.0 SP3

8. Using VFP 6.0 AND VB 6.0

9. Problems Using VB 6.0 Data controls with Access 2000

10. Using Access Database in VB 6.0

11. Using Access Database in VB 6.0

12. Using Access Database in VB 6.0

 

 
Powered by phpBB® Forum Software