View Single Post
 
Old 09-15-2022, 02:33 AM
TheBigBoss TheBigBoss is offline Windows 7 32bit Office 2010 32bit
Advanced Beginner
 
Join Date: Dec 2016
Posts: 56
TheBigBoss is on a distinguished road
Default

Hi Guessed,

Splitting the lines with vbLf fixed it. No more <CR>, no more hanging "0".
Code:
lines = Split(Input$(LOF(hf), #hf), vbLf)
And you were totally right (sorry I misunderstood you here) but creating a MS Word instance for parsing the txt file was way too much (and may be the reason for the problem).... so I used Open to deal directly with .txt file

Code:
Sub DCS_Get_Properties(sFN As String)
    ' Load core content using data txt file
    Dim hf As Integer: hf = FreeFile
    Dim oD As Object, PropLang As String, PropCat As String, PropNoSymbol As String, _
        bool As Boolean, sFE As String, dc(60, 8) As String, _
        i As Integer, lines() As String, tmp2() As String
    Open sFN For Input As #hf
    lines = Split(Input$(LOF(hf), #hf), vbLf)
    Close #hf
    For i = 0 To UBound(lines)
        If (Trim(lines(i))) <> "" Then
            Debug.Print "line " & lines(i)
            tmp2 = Split(lines(i), " ++ ")
            dc(i, 0) = tmp2(0) ' Table no
            dc(i, 1) = tmp2(1) ' Row no
            dc(i, 2) = tmp2(2) ' Cell no
            dc(i, 3) = tmp2(3) ' Data Type
            dc(i, 4) = tmp2(4) ' Content type
            dc(i, 5) = tmp2(5) ' Cell style
            dc(i, 6) = tmp2(6) ' Cell content
        End If
    Next
    For i = 0 To UBound(lines)
        Debug.Print "CONTENT - " & dc(i, 6)
        If dc(i, 3) = "Prop" Then
            If dc(i, 4) = "PropLang" Then
                PropLang = dc(i, 6)
                Call WriteProp("Prop-Language", PropLang)
            ElseIf dc(i, 4) = "PropCat" Then
                PropCat = dc(i, 6)
                Call WriteProp("Prop-Category", PropCat)
            ElseIf dc(i, 4) = "PropNoSymbol" Then
                PropNoSymbol = dc(i, 6)
                Call WriteProp("Prop-NoSymbol", PropNoSymbol)
            Else
            End If
        Else
        End If
    Next
I wish to thank you for your reply, it did help.
Attached Files
File Type: txt 615e8498df6dc933e3baf8732fe5ecf38f4a62b5.txt (481 Bytes, 4 views)
Reply With Quote