Results 1 to 6 of 6

Text File import program not functioning

Threaded View

  1. #1
    Registered User
    Join Date
    01-22-2010
    Location
    Sheffield
    MS-Off Ver
    Excel 2003
    Posts
    4

    Text File import program not functioning

    This code is from an edited macro & is designed to import a text file which is stored automatically with a date based name

    "Ext" reffers to pre defined file extention string, and the FileName string is made up of information from cells in the spreadsheet. I have tested this string and it is producing the correct filename (I think!).

    The code will not function and I can't figure out why. When I debug, it highlights the final line " .Refresh BackgroundQuery:=False". Any fix or alternate code sugestions would be very welcome.

    Dim FileName As String
    FileName = "TEXT;\\dd-001093-c\PressFiles\frf5600\Furnaces\Furnace" & Sheets("Control").Range("J6").Text & "\" & Sheets("Control").Range("G7").Text & Ext
    
        Sheets("Data").Select
        With ActiveSheet.QueryTables.Add(Connection:= _
        FileName, _
            Destination:=Range("A1"))
            .Name = Sheets("Control").Range("G7")
            .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 = xlDelimited
            .TextFileTextQualifier = xlTextQualifierDoubleQuote
            .TextFileConsecutiveDelimiter = True
            .TextFileTabDelimiter = False
            .TextFileSemicolonDelimiter = False
            .TextFileCommaDelimiter = False
            .TextFileSpaceDelimiter = True
            .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
            .TextFileTrailingMinusNumbers = True
            .Refresh BackgroundQuery:=False
        End With
    End Sub
    Last edited by Oliver H; 01-25-2010 at 05:29 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