Write to csv
Hi,
I am writing to a csv. Here is the issue,
I am writing data that is text, number, and dates.
I can write the values to csv using the string data type but there are
quotes around all of the data.
Is it possible to get rid of the quotes.
"....."
Option Explicit
Sub MainTest()
Dim tFilename As String
Dim tFilelocation As String
tFilename = "Iinforce.csv"
tFilelocation = "C:\"
Call FixIinforce(tFilename, tFilelocation)
End Sub
Sub FixIinforce(Filename As String, FileLocation As String)
Dim Sourcefile As String
Dim Outputfile As String
Dim i As Integer
Dim k As Integer
Dim temp As String
Sourcefile = FileLocation & Filename
Outputfile = FileLocation & "Iinforce(new).csv"
Open Sourcefile For Input As #1 '#SourceFileNb
Open Outputfile For Output As #2 '#OutputFileNb
'Key Past Header
For i = 1 To 42
Input #1, temp
Write #2, temp,
Next i
Input #1, temp
Write #2, temp
For k = 1 To 1000
For i = 1 To 43
Select Case i
Case 1 To 2
Input #1, temp
Write #2, k,
Case 3 To 42
Input #1, temp
Write #2, temp,
Case 43
Input #1, temp
Write #2, temp
End Select
Next i
Next k
Close #1
Close #2
MsgBox "Done!"
End Sub
Thanks for your help
|