+ Reply to Thread
Results 1 to 6 of 6

macro to open multiple text files

  1. #1
    Registered User
    Join Date
    02-05-2013
    Location
    Hawaii, USA
    MS-Off Ver
    Excel 2011
    Posts
    2

    macro to open multiple text files

    I am new to creating macros and would like to open many (100s) space delimited text files into Excel (Mac 2011). The following works for one file (123test.txt) but is there some way to open all .txt files within a specified folder (in this case "MRStexts") so I can do this in batches instead of one at a time? Thanks in advance!

    Please Login or Register  to view this content.
    Last edited by arlu1201; 02-06-2013 at 04:48 AM.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro to open multiple text files

    First of all a warning the commands I've used works in Excel 2007 and 2003 but as I do have Excel 2011 (Mac) I really don't know if this will work for you.

    Please Login or Register  to view this content.
    Alf

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: macro to open multiple text files

    ccloak,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  4. #4
    Registered User
    Join Date
    02-05-2013
    Location
    Hawaii, USA
    MS-Off Ver
    Excel 2011
    Posts
    2

    Re: macro to open multiple text files

    Alf, thanks but I get a Run-time error '68': Device unavailable at
    Please Login or Register  to view this content.
    I think it does not like the *
    When I substitute an actual file name for the * it opens that file just fine...
    Any suggestions?
    Last edited by ccloak; 02-07-2013 at 10:50 PM.

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro to open multiple text files

    I think it does not like the *
    Oh dear the "*" was supposed to be the wildcard that should make it possible to loop through all the files with ".txt" ending in sPath folder.

    If you can find out what the wildcard character for Excel Mac version is try to substitute "*" with that. Sorry but as I don't use Excel Mac nor know anybody who does so I can't help you any further.

    Alf

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: macro to open multiple text files

    Found a link at Roin de Bruin with macros and example to dowload for Excel 2011 (Mac). Amost at the bottom of the page there is a description of how to "Loop through files in a folder on a Mac"

    http://www.rondebruin.nl/mac.htm#Loop

    Alf

+ 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