Importing pipe delimited text file into Excel

Importing pipe delimited text file into Excel

Postby hua » Fri Mar 08, 2019 8:33 am

Hi guys,
I'm trying to open multiple pipe delimited text file into the same excel file albeit within different sheets.

How to convert VBA macro code generated below to FWH/[x]Harbour's code?

Code: Select all  Expand view  RUN

With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\test\pay32\LHDN\E9139122309 MASTER.txt", Destination:=Range("$A$1"))
        .Name = "E9139122309 MASTER"
        .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 = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileOtherDelimiter = "|"
        .TextFileColumnDataTypes = Array(1, 1, 2, 1, 4, 1, 4, 4, 1, 1, 2, 1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
    Sheets("Sheet2").Select
    With ActiveSheet.QueryTables.Add(Connection:= _
        "TEXT;C:\test\pay32\LHDN\E9139122309 CHART.txt", Destination:=Range("$A$1"))
        .Name = "E9139122309 CHART"
        .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 = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileOtherDelimiter = "|"
        .TextFileColumnDataTypes = Array(1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
 


TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests