Also, if you read the data back into the array using the Get #intff, 1, udtType(), you will need to know how many records are in the file so you can ReDim udtType() appropriately...

Try this. I can't test it right now but it should work...just put this code into an empty form:

VB Code:
  1. Option Explicit
  2.  
  3. Private Type MYTYPE
  4.     strOne As String
  5.     strTwo As String
  6.     strThree As String
  7. End Type
  8.  
  9. Private udtType() As MYTYPE
  10.  
  11. 'Turns a number like "4" into "0004"
  12. Private Function PadNumber(TheNumber As String, ByVal Length As Long) As String
  13.     Dim lonLen As Long
  14.    
  15.     lonLen = Len(TheNumber)
  16.    
  17.     If lonLen = Length Then
  18.         PadNumber = TheNumber
  19.     Else
  20.         PadNumber = String$(Length - lonLen, "0") & TheNumber
  21.     End If
  22.    
  23. End Function
  24.  
  25. 'Turns a number like "0004" into "4"
  26. Private Function RemoveHeader(TheHeader As String) As String
  27.     Dim lonLen As Long, lonLoop As Long
  28.    
  29.     lonLen = Len(TheHeader)
  30.    
  31.     For lonLoop = 1 To lonLen
  32.        
  33.         If Not Mid$(TheHeader, lonLoop, 1) = "0" Then
  34.             RemoveHeader = Mid$(TheHeader, lonLoop)
  35.             Exit Function
  36.         End If
  37.    
  38.     Next lonLoop
  39.    
  40. End Function
  41.  
  42. 'Debug the array.
  43. Private Sub DebugType()
  44.     Dim intLoop As Integer
  45.     Dim strName As String
  46.    
  47.     For intLoop = 0 To UBound(udtType())
  48.        
  49.         With udtType(intLoop)
  50.             strName = "udtType(" & intLoop & "):"
  51.             Debug.Print strName
  52.             Debug.Print String$(Len(strName), "-")
  53.             Debug.Print "One:   " & .strOne
  54.             Debug.Print "Two:   " & .strTwo
  55.             Debug.Print "Three: " & .strThree
  56.             Debug.Print ""
  57.         End With
  58.    
  59.     Next intLoop
  60.    
  61. End Sub
  62.  
  63. 'Just load some stuff into the UDT array.
  64. Private Sub InitType()
  65.     Dim intLoop As Integer
  66.    
  67.     Randomize
  68.    
  69.     ReDim udtType(50) As MYTYPE
  70.    
  71.     For intLoop = 0 To 50
  72.        
  73.         With udtType(intLoop)
  74.             .strOne = "1 (" & intLoop & ")"
  75.             .strTwo = CStr(Int(Rnd * 255) + 1)
  76.             .strThree = CStr(Int(Rnd * 255) + 1)
  77.         End With
  78.    
  79.     Next intLoop
  80.    
  81. End Sub
  82.  
  83. Private Sub Form_Load()
  84.     Dim intFF As Integer
  85.     Dim strHeader As String
  86.    
  87.     'Load stuff into the array.
  88.     InitType
  89.    
  90.     intFF = FreeFile
  91.     strHeader = PadNumber(UBound(udtType), 4)
  92.    
  93.     'Write file.
  94.     Open "C:\dump.txt" For Binary Access Write As #intFF
  95.         'Write header.
  96.         Put #intFF, 1, strHeader
  97.         'Write data.
  98.         Put #intFF, Len(strHeader) + 1, udtType()
  99.     Close #intFF
  100.    
  101.     DebugType
  102.    
  103.     'Load file back.
  104.     intFF = FreeFile
  105.     strHeader = String$(4, " ")
  106.    
  107.     Dim lonLenData As Long
  108.    
  109.     Open "C:\dump.txt" For Binary Access Read As #intFF
  110.         'Read header.
  111.         Get #intFF, 1, strHeader
  112.        
  113.         'Read data.
  114.         lonLenData = CLng(RemoveHeader(strHeader))
  115.         ReDim udtType(lonLenData) As MYTYPE
  116.        
  117.         'Data always starts at 5th byte (header is 4 bytes).
  118.         Get #intFF, 5, udtType()
  119.     Close #intFF
  120.    
  121.     DebugType
  122. End Sub