Problem with Split() function delimiters...

mikewood1980

Registered User.
Local time
Today, 18:07
Joined
May 14, 2008
Messages
45
Hi

I've got a small problem with the parsing data using the split() function. The code below functions when the "PasteClipBoard" button is pressed. The code pastes the results in the box and uses the split function to put each value into 22.2, 32.1 etc into each field of the array "arrResultsData".

Code:
Private Sub txtPasteClipboard_Click()

   
    Dim test As String
   
    Dim arrResultsData As Variant
    Dim chrCurrentResult As String
   
            ' set the focus on the text box
            txtResults.SetFocus
           
            ' paste the clipboard contents
            DoCmd.RunCommand acCmdPaste
           
            ' commit the paste
            DoCmd.RunCommand acCmdSaveRecord
           
            ' splits the text into a one-dimensional array
            test = Split(txtResults, vbCrLf)(0)
            MsgBox (test)
        
           
   
       
       
   

End Sub


This works fine with data pasted from a column in an excel document, but when pasting from NorBuild (software where we need to get the data from) I get the following result:

coderesult.jpg


As you can see there is a strange [?] value in the text box when i paste so the string cannot be split using vbCrLf as the delimiter.

Does anyone have any idea as to what I can use as an alternative delimiter?

Thanks in advance for your help
Mike Wood
 
I think I would try to figure out what is coming over as the delimeter when you do the paste - Maybe you can paste into notepad and figure it out? And I'm not sure I've seen vbcrlf used as a delimeter - ? Where / what did that come from?
 
a Few things, you are not using the arrResultsData variable. you are using the test variable instead.
Code:
test = Split(txtResults, vbCrLf)(0)
splits the txtresults using the separator. Only the first (0) item will be put in the test variable. It gives you the output as shown in your message box.

You could try vbCr or vbLf instead.

HTH:D
 
hi guys
Ive posted it into notepad and get the following result:

pasteresults.jpg


Still not sure how to refer the unknown "box" character to use it as the delimiter....

Anyone any ideas - this is starting to drive me crazy!! :D

Mike
 

Users who are viewing this thread

Back
Top Bottom