Я пытаюсь написать код, который создает текстовый файл в указанном месте, и вводом является значение cel
Sub Create()
Dim myPathTo As String
myPathTo = "d:\users\"
Dim myFileSystemObject As Object
Set myFileSystemObject = CreateObject("Scripting.FileSystemObject")
Dim fileOut As Object
Dim myFileName As String
Dim lastRow As Long
lastRow = Cells(Rows.Count, 1).End(xlUp).row
Dim i As Long
For i = 2 To lastRow
If Not IsEmpty(Cells(i, 1)) Then
myFileName = Cells(i, 4) & ".txt"
Set fileOut = myFileSystemObject.opentextfile(myFileName, 8, True)
fileOut.Write Cells(i, 8)
fileOut.Close
End If
Next
Set myFileSystemObject = Nothing
Set fileOut = Nothing
End Sub
Ошибка не отображается. Не понимаю, почему это не работает