QueryTables.Add Method: Data import from networked computer

I'm fairly new to VB programming. How can I modify the 'Connection' of the following code to directly import the text file from a networked computer I have been ftp'ing the file to my workstation and manually importing into excel from there and would like to cut out that step. The networked computer also requires a user id and password to log on. Thanks for any help.

Sub SP1Log()

    With ActiveSheet.QueryTables.Add(Connection:= _

        "TEXT;C:\Documents and Settings\kxwelch.FGDOM01\Local Settings\Temporary Internet Files\Content.MSO\C1CAECB7.log" _

        , Destination:=Range("A1"))

        .Name = "local_machine"

        .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 = True

        .TextFileTabDelimiter = True

        .TextFileSemicolonDelimiter = False

        .TextFileCommaDelimiter = False

        .TextFileSpaceDelimiter = True

        .TextFileColumnDataTypes = Array(9, 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

End Sub

 



Answer this question

QueryTables.Add Method: Data import from networked computer

  • ljCharlie

    Is this the wrong forum What forum can I find out about code for importing text files into excel from a networked machine No replies Surely it's been done before. Please help. Links to examples, similar code, anything I can use to maybe derive what I need to do would be appreciated. Thanks again!

  • neuling700

    You make me sad...


  • QueryTables.Add Method: Data import from networked computer