View Single Post
 
Old 09-15-2022, 05:37 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

All right, here is the function and attached is the txt file with six (6) entries.

So it worked doing a vbLf Split of the text file, followed by a replace of vbCr with vbNullString.
All other combinations failed, I either get that hanging 0 and/or return.
Really strange??

I will mark this post resolved still in a few days


Code:
Sub TEST_Get_Properties()
    Dim hf As Integer: hf = FreeFile
    Dim oD As Object, PropLang As String, PropCat As String, PropNoSymbol As String, _
        ReqEmail As String, ReqID As String, sFE As String, dc(60, 8) As String, _
        i As Integer, lines() As String, tmp2() As String
    sFN = "C:\Users\" & Environ("UserName") & _
            "\615e8498df6dc933e3baf8732fe5ecf38f4a62b5.txt"
    ' Load core content using data txt file
    Open sFN For Input As #hf
    'lines = Split(Input$(LOF(hf), #hf), vbCr)
    'lines = Split(Input$(LOF(hf), #hf), vbCrLf)
    lines = Split(Input$(LOF(hf), #hf), vbLf)
    Close #hf
    For i = 0 To UBound(lines)
        If (Trim(lines(i))) <> "" Then
            ' Needed, to fix a bug
            ' lines(i) = Replace(lines(i), vbCrLf, vbNullString)
            ' lines(i) = Replace(lines(i), vbNewLine, vbNullString)
            ' lines(i) = Replace(lines(i), vbLf, vbNullString)
            lines(i) = Replace(lines(i), vbCr, vbNullString)
            Debug.Print "LINE" & i + 1 & ": " & lines(i) ' Show lines
            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
    ' Write properties
    For i = 0 To UBound(lines)
        Debug.Print "CONTENT" & i + 1 & ": " & 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
        ElseIf dc(i, 3) = "Request" Then
            If dc(i, 4) = "Email" Then
                'PropCat = dc(i, 6)
                Call WriteProp("Prop-ReqEmail", dc(i, 6))
             ElseIf dc(i, 4) = "ID" Then
                'PropCat = dc(i, 6)
                Call WriteProp("Prop-ReqID", dc(i, 6))
            Else
            End If
        Else
        
        End If
    Next
    Debug.Print "Properties set."
    Exit Sub
End Sub
Attached Files
File Type: txt 615e8498df6dc933e3baf8732fe5ecf38f4a62b5.txt (287 Bytes, 6 views)
Reply With Quote