Sub GetFileCodes() 'ïðîöåäóðà ïîëó÷åíèÿ èìåíè ôàéëà ñ êîäàìè è òàðèôàìè ãîðîäîâ
Dim Filt As String, FilterIndex As Integer, FileName As Variant, Title As String 'îáúÿâëÿåì ïåðåìåííûå
Filt = "Ôàéëû Excell (*.xls),*.xls" 'Óñòàíîâêà îòîáðàæàåìûõ ôàéëîâ(ïî øàáëîíó)
FilterIndex = 1 'çíà÷åíèå ïî óìîë÷àíèþ
Title = "Âûáåðèòå ôàéë ñ êîäàìè ãîðîäîâ" 'çàãîëîâîê îêíà
FileName = Application.GetOpenFilename(FileFilter:=Filt, FilterIndex:=FilterIndex, Title:=Title) 'âûâîäèì îêíî è ïîëó÷àåì èìÿ ôàéëà
If FileName = False Then 'åñëè íå âûáðàí ôàéë âûõîä èç ïðîöåäóðû
MsgBox "Ôàéë íå âûáðàí, äàëüíåéøàÿ îáðàáîòêà íåâîçìîæíà!"
Exit Sub
Else: Call tariff(FileName)
End If
End Sub
и еще код
Sub tariff(FileName)
For a = 1 To 500
Set b = Application.Workbooks(FileName).Worksheets(CODE).Range("A1").Offset(a - 1, 0)
Next a
End Sub
получается эксель не может обрабатывать закрытые рабочие книги?