Connect to text file

KenHigg

Registered User
Local time
Today, 04:13
Joined
Jun 9, 2004
Messages
13,291
I have a spreadsheet that connects a text file and I can not figure out how to connect to it with vba in Access 2003. The following code works with Excel:

Code:
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;http://ftpweb.mysite.com/arcmaint/rpt_all_maint.txt", Destination:=Range _
        ("A2"))
        .Name = "rpt_all_maint"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With

Any ideas - ? I've tried a couple obvious methods but it doesn't seem to like th file being on a web site...
 

Users who are viewing this thread

Back
Top Bottom