Hi Steve,
I'm using option explicit, so I needed to dim each variable before the
subroutine would run.
However, I must have gotten something wrong, because it fails at
strRecord = Cells(R, 1).Value with the message Run-time error '91':
Object variable or With block variable not set.
Do you know where I went wrong? Here is how I've revised your code.
Sub ExportCSV()
Dim strFldrPath As String
Dim FSO As Object
Dim objCSVfile As Object
Dim R As Integer
Dim strRecord As Range
Dim C As Integer
strFldrPath = "K:\Customer Service\Quote\"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objCSVfile = FSO.CreateTextFile(strFldrPath & "\myData.csv")
For R = 1 To 100
strRecord = Cells(R, 1).Value
For C = 2 To 7
strRecord = strRecord & "," & Cells(R, C)
Next C
objCSVfile.WriteLine strRecord
Next R
objCSVfile.Close
Set FSO = Nothing
End Sub
Thanks,
Dan