Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After some thinking </p> <p>create a Class module and name it <code>Location</code></p> <p>this is the code to use in the class module</p> <pre><code>Option Explicit Public LocationID As String Public Description As String Public ZoneID As String Public IsntEmpty As Boolean Public LastPalletArrivedTime As Date Public PalletID As String Public Sequence As Long Public Property Let Item(index As Long, value As Variant) Select Case index Case 1 LocationID = value Case 2 Description = value Case 3 ZoneID = value Case 4 IsntEmpty = value Case 5 LastPalletArrivedTime = value Case 6 PalletID = value Case 7 Sequence = value End Select End Property Public Property Get Item(index As Long) As Variant Select Case index Case 1 Item = LocationID Case 2 Item = Description Case 3 Item = ZoneID Case 4 Item = IsntEmpty Case 5 Item = LastPalletArrivedTime Case 6 Item = PalletID Case 7 Item = Sequence End Select End Property </code></pre> <p>this is a standard Module1 for testing (<em>note the commented section</em>)</p> <pre><code>Option Explicit Sub Main() Dim myLoc As Location Set myLoc = New Location Dim i As Long '//////////////// ' SAMPLE filling For i = 1 To 7 ' covering BOOLEAN If i = 4 Then myLoc.Item(i) = False ' covering DATE ElseIf i = 5 Then myLoc.Item(i) = Now ' covering LONG ElseIf i = 7 Then myLoc.Item(i) = i ' convering STRING Else myLoc.Item(i) = CStr("property " &amp; i) End If Next i '/////////// ' PRINTING For i = 1 To 7 Debug.Print "property:" &amp; i, myLoc.Item(i) Next i '///////////////// ' pay attention ' this is what you could do ' this section is commented as Im unable to test it ' but this should work for you ' create a collection ' Dim c As Collection ' Set c = New Collection ' ' Dim x As Long ' For x = 1 To UBound(TextFileLine()) ' Dim loc As Location ' Set loc = New Location ' ' For i = 1 To 7 ' loc.Item(i) = SplitTextLines(x, i - 1) ' Next i ' ' c.Add loc ' Next x ' ' ' now if you wanted to retrieve the data ' ' you iterate over the collection ' ' For i = 1 To c.Count ' For j = 1 To 7 ' Debug.Print c.Item(i).Item(j) ' Next j ' Next c End Sub </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload