Chris, try this out on your file. This code replaces "," with "|" (a
pipe with quotes) so that it can be easily converted to an array. You
may have to make some modifications to save each line to an array:

    Dim SEARCH_STRING As String     'String we don't want
    Dim REPLACE_STRING As String    'New string
    Dim strLineInput As String      'input string from file
    Dim strFileName As String       'file name
    
    Dim intOpenNumber As Integer      'FreeFile number
    
    strFileName = "C:\test.txt"    'TODO: get the file name and set it here
    
    SEARCH_STRING = Chr(34) & "," & Chr(34)     'find ","
    REPLACE_STRING = Chr(34) & "|" & Chr(34)    'replace with "|"
    
    intOpenNumber = FreeFile
    
    Open fileName For Input As #intOpenNumber
        
        Do While Not EOF(intOpenNumber)
            
            Line Input #intOpenNumber, strLineInput
                
                Debug.Print ("Before conversion: " & strLineInput)
            
            strLineInput = Replace(strLineInput, SEARCH_STRING, REPLACE_STRING)
                
                Debug.Print ("After conversion: " & strLineInput)
            
            'TODO: code here to do work on the modified string i.e.,
            'make an array using the pipe to split the input line, etc.
            
        Loop
        
    Close #intOpenNumber


On Tue, 22 Feb 2005 20:43:11 -0000, HouseDad <[EMAIL PROTECTED]> wrote:
> 
> 
> --- In [email protected], "Ian Brooke" <[EMAIL PROTECTED]> wrote:
> > Hi,
> > The Line Input #n,aString command will read an entire line (as long
> as it's terminated by a CR/LF) even if it has commas in it.
> >
> > Ian
> 
>     Yes indeed, and I use it quite a bit.  Unfortunately, it doesn't
> help me much when there are commas in the middle of the field.
> Unless, of course, there is a way to use SPLIT to read the line into
> an array, without those pesky commas in the middle of the field
> screwing the fields up.
> 
>     The only thing I have found so far is one guy said if you set a
> type up then input them all in the same line (ie input #1,a$,b$,C$)
> and delimit them without commas (ie "field 1""field2""field3") that
> it would ignore all the commas that way, but haven't tried that yet,
> and I don't think it's correct, judging from his example that was
> posted.  I could erase the commas in an incoming files I guess (if
> there's quotes on either side of the comma then delete it), but I
> would like to get around that if possible.
> 
> [C]
> 
> '// =======================================================
>    Rules : http://ReliableAnswers.com/List/Rules.asp
>    Home  : http://groups.yahoo.com/group/vbHelp/
>    =======================================================
>    Post  : [email protected]
>    Join  : [EMAIL PROTECTED]
>    Leave : [EMAIL PROTECTED]
> '// =======================================================
> 
> Yahoo! Groups Links
> 
> 
> 
> 
> 


-- 
---
Don Roberts - [EMAIL PROTECTED]
http://www.drscripting.com
http://www.freakingidiot.com



'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [email protected]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to