Type osoba maticniBr As String ime As String prezime As String datumR As String adresa As String telefon As String End Type Type binar maticniBr() As Byte ime() As Byte prezime() As Byte datumR() As Byte adresa() As Byte telefon() As Byte End Type Function saveBinFile() Dim O As osoba Dim B As binar Dim maticni As Long 'vrijednost kucice Dim strSize As Long Dim tmp() As Byte Open "c:\popis.bin" For Binary As #1 'Len = Len(O) For f = 1 To 50 Worksheets("list1").Select maticni = Cells(f + 1, 1) O.maticniBr = maticni O.ime = Cells(f + 1, 2) O.prezime = Cells(f + 1, 3) O.datumR = Cells(f + 1, 4) Worksheets("list2").Select O.adresa = Application.WorksheetFunction.VLookup(maticni, Range("A2:e51"), 4, False) O.telefon = Str(Application.WorksheetFunction.VLookup(maticni, Range("A2:e51"), 5, False)) B.adresa = O.adresa B.maticniBr = O.maticniBr B.ime = O.ime B.prezime = O.prezime B.datumR = O.datumR B.telefon = O.telefon Put 1, , B Next f 'sljedeci red Close 1 'zatvorimo datoteku End Function Function UcitajRed(KojiRed As Integer) Dim RedP As binar 'red podataka za ososubu Dim t As osoba Dim temp Dim I As Integer Open "c:\popis.bin" For Binary As #1 For I = 1 To KojiRed Get #1, , RedP Next I temp = Trim(RedP.ime) & " " & Trim(RedP.prezime) & vbCr & "Rodjen: " & Trim(RedP.datumR) _ & vbCr & "Adresa:" & Trim(RedP.adresa) _ & vbCr & "Matcini br:" & Trim(RedP.maticniBr) & vbCr & "Tel:" & Trim(RedP.telefon) Close #1 MsgBox temp End Function