I have the script running perfectly, but there is just one problem. In the event that someone enters a value with a comma in a cell it prints the csv file incorrectly.
Here is the code:
Public Sub WriteSheet(curSheet As Worksheet, pathstr As String, col As Long, row As Long)
Dim txtStr As String
Dim x As Long
Dim y As Long
Dim i As Long
Dim StateCol As Long
Dim CountyCol As Long
On Error GoTo err_handler
FirstFlag = True
For y = 1 To row
txtStr = ""
For x = 1 To col
txtStr = txtStr & "," & curSheet.Cells(y, x).Text
Next x
'write out the file
txtStr = Right(txtStr, Len(txtStr) - 1)
Call writetxt(pathstr, txtStr)
Next y
Exit Sub
err_handler:
MsgBox Err.Description
End Sub
Thanks for any help!
Here is the code:
Public Sub WriteSheet(curSheet As Worksheet, pathstr As String, col As Long, row As Long)
Dim txtStr As String
Dim x As Long
Dim y As Long
Dim i As Long
Dim StateCol As Long
Dim CountyCol As Long
On Error GoTo err_handler
FirstFlag = True
For y = 1 To row
txtStr = ""
For x = 1 To col
txtStr = txtStr & "," & curSheet.Cells(y, x).Text
Next x
'write out the file
txtStr = Right(txtStr, Len(txtStr) - 1)
Call writetxt(pathstr, txtStr)
Next y
Exit Sub
err_handler:
MsgBox Err.Description
End Sub
Thanks for any help!