Results 1 to 5 of 5

Data import folder

Threaded View

  1. #1
    Registered User
    Join Date
    05-05-2010
    Location
    sydney
    MS-Off Ver
    Excel 2003
    Posts
    2

    Data import folder

    Hi all,

    Can you please assist. I currently got a macro that imports data (.dat), however i can only get it to pick it up from a specified location. The requirement is to make it pick up the files (they are always the same) from the same location that the spreadsheet is in. So pretty much fileName = ActiveWorkbook.Path + "<file name>". However, i can not get it to work. Can someoine please help me make the path the active workbook path. Thanks.
    My current code is.

    With ActiveSheet.QueryTables.Add(Connection:= _
            "TEXT;C:\Test\<test file.dat>", Destination:=Range("A1"))
            .Name = "<name>"
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .TextFilePromptOnRefresh = False
            .TextFilePlatform = 850
            .TextFileStartRow = 1
            .TextFileParseType = xlFixedWidth
            .TextFileTextQualifier = xlTextQualifierDoubleQuote
            .TextFileConsecutiveDelimiter = False
            .TextFileTabDelimiter = True
            .TextFileSemicolonDelimiter = False
            .TextFileCommaDelimiter = False
            .TextFileSpaceDelimiter = False
            .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1)
            .TextFileFixedColumnWidths = Array(1, 9, 50, 50, 50, 15, 37)
            .TextFileTrailingMinusNumbers = True
            .Refresh BackgroundQuery:=False
        End With
    Last edited by Leith Ross; 05-05-2010 at 07:10 PM. Reason: Added Code Tags

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