Paul Hartland (ISHARP)
paul.hartland at isharp.co.uk
Wed Oct 27 08:27:22 CDT 2004
Thanks, I will have a go at converting it to VBA first Paul -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan Sent: 27 October 2004 13:49 To: Access Developers discussion and problemsolving Subject: Re: [AccessD] Import CSV file with Unix end of line characters On 27 Oct 2004 at 13:14, Paul Hartland (ISHARP) wrote: > To all, > > Could someone please tell me or send me some sample code on the best > way to import a CSV file which has Unix end of line characters. > Here's the PowerBasic code for a simple converter I use for this. You could probably do the same thing in VBA with a few minor mods. I can let you have the compiled executable if you want it. FUNCTION PBMAIN() AS LONG DIM infile AS STRING DIM outfile AS STRING DIM temp AS STRING infile = COMMAND$ IF DIR$(infile) = "" THEN MSGBOX infile & " not found" EXIT FUNCTION END IF OPEN infile$ FOR BINARY AS #1 GET$ #1, LOF(1), temp IF INSTR(temp,CHR$(13,10)) > 0 THEN MSGBOX "This file is already DOS formatted!" ELSE REPLACE CHR$(10) WITH CHR$(13,10) IN temp outfile = LEFT$(infile,LEN(infile)-4) & "-DOS.CSV" OPEN outfile$ FOR BINARY AS #2 PUT$ #2, temp MSGBOX Infile & " converted to " & outfile CLOSE #2 END IF CLOSE #1 END FUNCTION 0 -- Stuart -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com