Results 1 to 6 of 6

Thread: Clean a string

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    736

    Clean a string

    Hi guys
    Got a bit of brain bashing for you, i am well aware of how to clean a string of VbCrLf and also how to split data but my brain is stuck as to the best way to do what i want to do.

    basically i have a string of clipboard data that is tab delimited and pasts nicely into Excel. problem is there are occasionally some unexpected VbCrLf. at first i thought ah thats easy so i did the following

    Code:
    Public MyDataObj As New DataObject
    Public StrInput() As String
    Public StrFinal As String
    
    Private Sub CommandButton1_Click()
    MyDataObj.GetFromClipboard
    StrInput = Replace(MyDataObj.GetText, vbCrLf, "")
    MyDataObj.SetText ("")
    MyDataObj.PutInClipboard
    End Sub
    almost works but i overlooked the carriage return that is needed at the end of each line to put the data in rows. just so its clear its like this

    Data1 vbtab Data2 vbtab Data3 vbcrlf
    Data1 vbtab data2 vbtab Data3 vbcrlf

    So you see my above code will remove the legitimate VbCrLf any ideas?
    Last edited by nabbster; Feb 5th, 2008 at 04:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width