+ Reply to Thread
Results 1 to 5 of 5

Adapt macro to batch process files

  1. #1
    Registered User
    Join Date
    05-10-2011
    Location
    Miami
    MS-Off Ver
    Excel 2007
    Posts
    28

    Adapt macro to batch process files

    I have an extensive macro that processes raw .dat files into finished excel sheets - it imports, formats, calculates, graphs and more. The problem now is that I have a huge number of new files that I need to process, so I want to try and further automate the process. Is there a way to add a loop to the macro so that it sequentially goes through a folder and runs on each successive .dat file? My searches so far have found solutions where the batch processing is done all at the same time, due to file sizes and computing power, I would need to do this sequentially.

    Thanks in advance for any tips and guidance!

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Adapt macro to batch process files

    Hi beng404,

    Try this - just change the two lines marked with 'change to suit' for your needs:

    Please Login or Register  to view this content.
    The running of the ImportAllBATFiles macro will then run your existing macro (set as Macro1 above) for each .dat file in the 'strDirectory' directory.

    Regards,

    Robert
    Last edited by Trebor76; 08-26-2012 at 09:04 PM.
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    05-10-2011
    Location
    Miami
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Adapt macro to batch process files

    I keep getting a compile error at StrConv saying argument not optional. I am tooling around with it to try and figure it out, will post back if I get it.

    This will really save me an incredible amount of time once it works- thanks so much!

  4. #4
    Registered User
    Join Date
    05-10-2011
    Location
    Miami
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Adapt macro to batch process files

    I didn't figure out what I was missing on StrConv, but did modify your for/next loop to find a work around

    Please Login or Register  to view this content.
    Thanks!

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,523

    Re: Adapt macro to batch process files

    Glad to hear you got it sorted and thanks for marking the thread as solved

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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