View Single Post
 
Old 09-15-2022, 04:28 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Here is a concept to read the text into an array of arrays.
Source: Function was based on the stellar work of Bob77 on StackOverflow - vb6 - Array and Split commands to create a 2 dimensional array - Stack Overflow
Code:
Sub TEST_Get_Properties()
  Dim hf As Integer, sFN As String, lines As String
  Dim myArray As Variant, iRow As Integer, iCol As Integer
  sFN = "C:\Users\" & Environ("UserName") & "\615e8498df6dc933e3baf8732fe5ecf38f4a62b5.txt"
  ' Load core content using data txt file
  hf = FreeFile
  Open sFN For Input As #hf
    lines = Input$(LOF(hf), #hf)
  Close #hf
  myArray = SplitSplit(lines)
  For iRow = 0 To UBound(myArray)
    For iCol = 0 To UBound(myArray(iRow))
      Debug.Print "Row:" & iRow, "Col:" & iCol, myArray(iRow)(iCol)
    Next
  Next
End Sub

Private Function SplitSplit(ByRef Delimited As String, Optional sDiv1 As String = vbLf, Optional sDiv2 As String = " ++ ") As Variant
  Dim Rows() As String, AryOfArys As Variant, I As Long
  Rows = Split(Delimited, sDiv1)
  ReDim AryOfArys(UBound(Rows))
  For I = 0 To UBound(Rows)
    AryOfArys(I) = Split(Rows(I), sDiv2)
  Next
  SplitSplit = AryOfArys
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia

Last edited by Guessed; 09-15-2022 at 11:35 PM.
Reply With Quote