Moke123,
I've attempted to mimic your use of FSO from attachment in #7. Obviously, I still don't have things right, witness screenshot collage of debug revelations below:
I'm also posting the entire piece of code involved that shows my changes plus the comment narrative of the function in the hopes it will help clear up the intent.
Code:
Private Function PlayGap()
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
' When a user wants to play the works of a GAP concert, the request is initiated by
' right-clicking on the performance date and choosing Play Works or Cast Works.
' In either case, our "calling code" has already identified the volumes that contain
' the mp3/mp4 files that will comprise the playlist. Our task here is simple, we
' copy the 1st half files to a temporary folder named "Playlist" and then append the
' 2nd half files from their original source folder adding 100 to the leading file number.
' The PLOV value we need to identify the 2nd half files is already set in strPLOV.
'
' PLOV of the form "nn/ss" and defines the subset of files we need to copy from the 2nd
' half folder, "strFldrGAP2. ALL files numerically sequenced, i.e., "01name1.mp4";
' "02name2.mp4";"03name3.mp4"......."99name99.mp4". ' Example: PLOV = "04/05" defines
' the subset of 4 files beginning with file number 5. We need to essentially add 100
' to the prefix values of the copy, lest we collide with files already copied into the
' playlist folder for the 1st half of the GAP. For purposes of the temporary playlist,
' we'll not need the file names, only the sequence numbers as names.
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Dim FSO As New FileSystemObject
Dim FileName As File
Dim FldrName As folder
Dim strFrom As String
Dim strTO As String
Dim strNamePrfx As String
Kill (StrFldrPath & "\PlayList\*.*") 'Empty old playlist
'*=*=*=(Copy 1st half of GAP to PlayList)=*=*=*
strFrom = StrFldrPath & "\" & strFldrGAP1 & "\*.*"
strTO = StrFldrPath & "\playlist\"
Set FSO = CreateObject("Scripting.FileSystemObject")
Call FSO.CopyFile(strFrom, strTO)
'*=*=*=(Now the 2nd half)=*=*=*=*=*=*=*=*=*=*=*=*
intnT = Left(strPLOV, 2) 'How many tracks in the playlist?
intTn = Right(strPLOV, 2) 'What's the first track?
Set FldrName = FSO.GetFolder(StrFldrPath & "\" & strFldrGAP2)
strFrom = StrFldrPath & "\" & strFldrGAP2 & "\"
strTO = StrFldrPath & "\playlist\1"
J = intTn 'First file of subset bares this prefix
K = intnT 'Then sequentially "intnT" many files
For Each FileName In FldrName
If Left(FileName.Name, 2) = Right("0" & J, 2) Then
FSO.CopyFile strFrom & FileName.Name, strTO & FileName.Name
J = J + 1
K = K - 1
If K = 0 Then Exit For
End If
Next FileName
Set FSO = Nothing
End Function