Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 09-15-2022, 02:33 AM
TheBigBoss TheBigBoss is offline Reading basic .txt file fails, how can it be? Windows 7 32bit Reading basic .txt file fails, how can it be? Office 2010 32bit
Advanced Beginner
Reading basic .txt file fails, how can it be?
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
The “spelling and grammar” check fails to work as the number of words in the file exceeds a certain Jamal NUMAN Word 3 09-24-2019 10:45 AM
Reading basic .txt file fails, how can it be? Need plugin for reading+converting *.pdf file into *.doc pstein Word 1 05-24-2015 07:05 AM
Reading pane on TOP? hehunt Outlook 0 04-10-2014 06:34 AM
Reading basic .txt file fails, how can it be? How to save a PPT file in 'Reading View' to be opened always in 'Reading View' ItzVickey PowerPoint 2 08-08-2012 09:23 AM
Reading basic .txt file fails, how can it be? Word Basic 2003 to Word Basic 2007 Incompatibility Mark1110 Word VBA 1 12-29-2010 11:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft