+ Reply to Thread
Results 1 to 5 of 5

Delimited Text File and VBA

  1. #1
    Registered User
    Join Date
    02-21-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    40

    Delimited Text File and VBA

    Hi all,

    I have the below bit of code which enables me to interrogate a text file in excel and only bring back the records I want based on a certain reference number. This works great where my text file is small...

    Please Login or Register  to view this content.
    The difficulty is when my text file is big (e.g. a couple of million records) the above basically takes too long to process. With a bit of help I have the below code which uses ADO DB connection which I am told will be the most efficient way for interrogating a much larger database... the issue I have is I am getting an error saying 'No value given for one or more required parameters' on the .Open str part.

    The column in the text file has a header of 'aa' and that is the only column I am using to search for a reference & if its there I want to bring it back into the excel document. Is there something obvious I am missing?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Delimited Text File and VBA

    Assuming B2 contains a string... Some idea of the data would have been useful.
    Please Login or Register  to view this content.
    Short reply, just in case.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Delimited Text File and VBA

    I think the path must use a trailing \ in the folder name.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    02-21-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: Delimited Text File and VBA

    Thanks both, still no luck with it and the .open str still highlighted in yellow.
    I attach a copy of the text file I am using, for example if aa = '123' then I would want those 2 records with the '123' to be brought back into the excel file.

    You'll see how this works in the import sheet. I basically want to replicate this for the module 3 macro which I am told will work better on much larger files.

    Could you review both these attachments and help me flag where I am going wrong?

    Cheers
    Attached Files Attached Files
    Last edited by DaveNUFC; 05-29-2016 at 03:47 PM.

  5. #5
    Registered User
    Join Date
    02-21-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    40

    Re: Delimited Text File and VBA

    Hi both, I wonder if this could be down to the wrong active object not being enabled?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Script/macro to save a copy as tab delimited text file and then close original file
    By Merlin803 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2015, 01:34 PM
  2. conversion of text file(delimited) into Excel file using macro
    By thara.p24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2014, 08:35 AM
  3. Saving multi-tab excel file created from comma delimited text file
    By Marcus Aurelius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2005, 01:20 PM
  4. Replies: 1
    Last Post: 05-03-2005, 06:06 PM
  5. [SOLVED] Export excel file to semicolon delimited text file
    By capitan in forum Excel General
    Replies: 5
    Last Post: 04-06-2005, 11:07 PM
  6. Export excel file to semicolon delimited text file
    By capitan in forum Excel General
    Replies: 5
    Last Post: 04-06-2005, 11:07 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1