Results 1 to 6 of 6

macro to open multiple text files

Threaded View

  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!

    Sub OpenMRStext()
    '
    ' OpenMRStext Macro
    ' Open space delimited MRS text files
    '
    ' Keyboard Shortcut: Option+Cmd+t
    '
        Workbooks.OpenText Filename:= _
            "Macintosh HD:Users:ccc:Desktop:MRStexts:123test.txt" _
            , Origin:=xlMacintosh, StartRow:=1, DataType:=xlDelimited, TextQualifier _
            :=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False _
            , Comma:=False, Space:=True, Other:=False
        
        
    End Sub
    Last edited by arlu1201; 02-06-2013 at 04:48 AM.

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