Hi,
First of all I would like to point out that I'm a complete beginner at vba. I've only been learning for a few days and am still finding my way around.
What my code does is create text files named as a particular song, and then writes the lyrics into those text files.
For some reason, at F16 the lyrics do not wish to write into the text file. The name of the file is "05 Blank Infinity.txt". However, when I change any part of the text file name (eg. Blasdfnk Infinity or Blank Infasdfnity) the lyrics write in perfectly.
This is the ONLY case in which lyrics do not get written in. I added a watch to the "LyricText" and saw that the lyrics string does get written into that. But for some reason it doesn't save.
Note: I am copying the text files to a MP3 player connected via usb.
First of all I would like to point out that I'm a complete beginner at vba. I've only been learning for a few days and am still finding my way around.
What my code does is create text files named as a particular song, and then writes the lyrics into those text files.
Code:
Else
LyricText = Range("F" & iRow)
MyFile.WriteLine (LyricText)
MyFile.Close
End If
For some reason, at F16 the lyrics do not wish to write into the text file. The name of the file is "05 Blank Infinity.txt". However, when I change any part of the text file name (eg. Blasdfnk Infinity or Blank Infasdfnity) the lyrics write in perfectly.
This is the ONLY case in which lyrics do not get written in. I added a watch to the "LyricText" and saw that the lyrics string does get written into that. But for some reason it doesn't save.
Note: I am copying the text files to a MP3 player connected via usb.
Code:
Option Explicit
Public PathCount As Long
Sub CreateTextFile()
Sheets("FileList").Activate
PathCount = 0
Dim fso
Dim Filepathname As String
Dim iRow As Long
Dim iCol As String
Dim MyFile
Dim LyricText As String
Set fso = CreateObject("Scripting.FileSystemObject")
iRow = "12"
iCol = "C"
While PathCount < CycleCount
Filepathname = Range("C9") & Range(iCol & iRow) & ".txt"
Set MyFile = fso.CreateTextFile(Filepathname, True)
If IsEmpty(Worksheets("Filelist").Range("F" & iRow)) = True Then
Else
LyricText = Range("F" & iRow)
MyFile.WriteLine (LyricText)
MyFile.Close
End If
iRow = iRow + 1
PathCount = PathCount + 1
Wend
Cells("10", "D") = PathCount
End Sub
Last edited: