Ask kind help: VB6 How to read the string line by line from the MS_Office Clipboard
Thanks in advance,

Recommended Answers

All 4 Replies

Well i don't know how but you can use the clipboard object in vb6 to get and set clipboard content.

Jhai, Thanks a lot, I know vb6 can use the GetText to get clipboard content.
The question is how to read it line by line? (to a string array)

I wonder if you can check for the new line in the clipboard. If yes, you can check

if (looping thru the array) = vbNewLine then

' do whatever

else

'do something else

end if

I have used this when reading a string so you must be able to use it in anarray
strVariable = Replace(strVariable, vbNewLine, vbNullString)

' Sorry to advise you
' the vbNewline does not be recognized by vb6, I had tred following code always rturn False
' first retrieve contents to a variable string OneClpBrd_Content

Private Sub Form_Load()
 TextBox2.Text = ""       '' setup MultiLine=True
 TextBox2.Text = vbNullString        '' setup MultiLine=True
 iPos = InStr(1, OneClpBrd_content, Chr(10))
 If iPos  0 Then
     q = q
 End If
 iPos = InStr(1, OneClpBrd_content, Chr(11))
 If iPos  0 Then
     q = q
 End If
 iPos = InStr(1, OneClpBrd_content, Chr(13))
 If iPos  0 Then
     q = q
 End If
 iPos = InStr(1, OneClpBrd_content, vbCrLf)
 If iPos  0 Then
     q = q
 End If
 iPos = InStr(1, OneClpBrd_content, vbNewLine)
 If iPos  0 Then
     q = q
 End If

 m_dtasplit = Split(OneClpBrd_content, vbNewLine)  ''  , -1, vbTextCompare
 If UBound(m_dtasplit)  0 Then
     a = a
 End If
 m_dtasplit = Split(OneClpBrd_content, Chr(10))  ''  , -1, vbTextCompare
 If UBound(m_dtasplit)  0 Then
     a = a
 End If
  m_dtasplit = Split(OneClpBrd_content, Chr(11))  ''  , -1, vbTextCompare
 If UBound(m_dtasplit)  0 Then
     a = a
 End If
 m_dtasplit = Split(OneClpBrd_content, Chr(13))  ''  , -1, vbTextCompare
 If UBound(m_dtasplit)  0 Then
     a = a
 End If

 m_dtasplit = Split(OneClpBrd_content, vbCrLf)  ''  , -1, vbTextCompare
 If UBound(m_dtasplit)  0 Then
     TextBox2.Text = m_dtasplit(0)
 End If

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.