This code is mainly for Qualtrics website users. Qualtrics currently has a problem exporting csv files where they include the entire question in the 2nd line of the csv. This makes it not to friendly for importing into MSAccess. The code below will open the csv file, skip the first line, delete the 2nd line, and then continue through the rest of the file, outputting it to a new file.

Try this code if you need to manipulate csv files, deleting certain lines. You can also use the 2 bottom functions if you ever need to trim out the path or file name from something like F:\Data\Databases\MyFileName.csv

Function ReSaveCSVWithSkipline(QualtricsIn As Variant)
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim ft, fs, t, s, temp, sample
Dim X As Integer


Dim QualtricsOut As Variant
QualtricsOut = GetPathPart(QualtricsIn) & GetNamePart(QualtricsIn) & "Out.csv"
Set fs = CreateObject("Scripting.FileSystemObject")
Set ft = CreateObject("Scripting.FilesystemObject")
fs.opentextfile QualtricsIn 'ie.."F:\Data\Databases\STQ\QualtricsDownloads\Bas elineResults.csv" - input text file
ft.createtextfile QualtricsOut 'ie.."F:\Data\Databases\STQ\QualtricsDownloads\Bas elineResultsOut.csv" - new output file with skipped 2nd line
Set s = fs.getfile(QualtricsIn)
Set t = fs.getfile(QualtricsOut)
Set QualtricsIn = s.OpenAsTextStream(ForReading, TristateUseDefault)
Set QualtricsOut = t.OpenAsTextStream(ForWriting, TristateUseDefault)
QualtricsOut.writeline (QualtricsIn.readline) 'read input and write output for first line...
QualtricsIn.SkipLine 'read 2nd line but don't write to output file..
Do While Not QualtricsIn.atendofstream 'now loop through the rest of the lines...
QualtricsOut.writeline (QualtricsIn.readline) 'writing to output file as each line is read...
Loop
End Function

Function GetNamePart(strIn As Variant) As Variant
Dim intCounter As Integer
Dim strTmp As String
For intCounter = Len(strIn) To 1 Step -1
If mid$(strIn, intCounter, 1) <> "\" Then
strTmp = mid$(strIn, intCounter, 1) & strTmp
Else
Exit For
End If
Next intCounter
GetNamePart = Left$(strTmp, Len(strTmp) - 4)
End Function

Function GetPathPart(strPath As Variant) As Variant
' Comments : Returns the path part of a string
' Parameters: strPath - string to parse
' Returns : path part
Dim intCounter As Integer
For intCounter = Len(strPath) To 1 Step -1
If mid$(strPath, intCounter, 1) = "\" Then
Exit For
End If
Next intCounter
GetPathPart = Left$(strPath, intCounter)
End Function