I need to load some data from an 2D array to an type array structure.
My type structure looks like the following:
Public Type LocationType
LocationID As String
Description As String
ZoneID As String
IsEmpty As Boolean
LastPalletArrivedTime As Date
PalletID As String
Sequence As Long
End Type
I declared the following:
Dim LocationArray() As LocationType
which needs to be filled with data from a 2D array.
The code I use to fill LocationArray is as follows:
For x = 1 To UBound(TextFileLine())
LocationArray(x).Description = SplitTextLines(x, 0)
LocationArray(x).LocationID = SplitTextLines(x, 1)
LocationArray(x).Sequence = SplitTextLines(x, 2)
LocationArray(x).ZoneID = SplitTextLines(x, 3)
LocationArray(x).PalletID = SplitTextLines(x, 4)
LocationArray(x).LastPalletArrivedTime = SplitTextLines(x, 5)
LocationArray(x).IsEmpty = SplitTextLines(x, 6)
Next x
I was wondering if there is any method or code I could use to make the code which I use to fill "LocationArray" easier?
*Note all my variables are declared and code is working. I am just asking for better or easier method to the one I am currently using. Help will be much appreciated.
After some thinking
create a Class module and name it
Location
this is the code to use in the class module
this is a standard Module1 for testing (note the commented section)