Курсовая работа: Компьютерная подготовка
Dim myRecord As Record
Dim data As Range, curRow As Range
Dim row As Integer
Range("A5").Activate
Set data = ActiveCell.CurrentRegion
data.ClearContents
Open dbFileName ForInputAs #1
row = 1
DoWhileNot EOF(1)
Input #1, myRecord.Fam, myRecord.Im, myRecord.Ot, myRecord.street, myRecord.no, myRecord.Flat, myRecord.Phone
putRecord ActiveCell.Cells(row), myRecord
row = row + 1
Loop
Close #1
ThisWorkbook.ActiveSheet.Protect
EndSub
Sub dbWrite()
ThisWorkbook.ActiveSheet.Unprotect
Dim myRecord As Record
Dim data As Range, curRow As Range
Range("A5").Activate
Set data = ActiveCell.CurrentRegion
Open dbFileName For Output As #1
ForEach curRow In data.Rows
myRecord = getRecord(curRow)
Write #1, myRecord.Fam, myRecord.Im, myRecord.Ot, myRecord.street, myRecord.no, myRecord.Flat, myRecord.Phone
Next curRow
Close #1
ThisWorkbook.ActiveSheet.Protect