Im creating a vba Function which creates a flat file with just one line, on same directory of my Excel file, everything works fine
but when I print that line which is contained inside of a string I get my message inside of quotation marks
if I expect something like
HDR201412101136452014121090105500000000000000000000
I get this
"HDR201412101136452014121090105500000000000000000000"
this is my code:
Public Function generateFlatFile()
Open ThisWorkbook.Path & "\" & FLAT_FILE_NAME For Output As #1
Dim header As String
header = "HDR"
header = header & Format(Now, "yyyymmddhhnnss")
header = header & Format(Now, "yyyymmdd")
header = header & Worksheets(BD).Cells(2, 3)
header = header & 5
header = header & "00000000000000000000"
Write #1, header
Close #1
End Function
Write #n
will enclose strings in quotation marks. If you want full control over how the file gets written, you need to use Print #n
instead.