Hi all, how do I insert the name of the parent folder in the example below? I am trying to set the path of the new text file in the same folder as the file opened (a, I think). Sure this is as clear as mud!
Dim fs, a, RS, temptext Dim peanut As String Dim coconut As String Dim STN As String ' Store Number Dim DTE As String 'File Date Dim getpeanut 'Get FileName to open getpeanut = Application.GetOpenFilename("SDF Files (*.sdf), *.sdf") Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.opentextfile(getpeanut, 1, -2) 'Establish new filename peanut = a.readline STN = Mid(peanut, 3, 5) DTE = Mid(peanut, 9, 6) 'Create new text file Set RS = CreateObject("Scripting.filesystemobject") Set temptext = RS.createtextfile("C:Accounting 4.01ServerIncomingSDF Files" _ & "Parent Name Here" & "" & STN & " " & DTE & ".txt", True) Set a = Nothing Set a = fs.opentextfile(getpeanut, 1, -2) Do While a.atendofstream True