Hello,

I have one code that can get me info in one format that I want. The code is here:
Sub ExportData()

LR = Cells(Rows.Count, "A").End(xlUp).Row
DestFile = "D:\pontebarca.txt"
FileNum = FreeFile()
Open DestFile For Output As #FileNum
For j = 2 To LR
  mdate = CDate(Cells(j, 1))
  If Len(mdate) > 10 Then
    mdate1 = Left(mdate, 10)
    mdate2 = Right(mdate, 8)
  Else
    mdate1 = mdate
    mdate2 = "00:00:00"
  End If
  mdate1 = Format(mdate1, "yyyy-mm-dd")
  ma = Cells(j, 2).Text
  s = "<event date=""" & mdate1 & """ time=""" & mdate2 & """ value=""" & ma & " flag=""2""/>"
  
  Print #FileNum, s
Next
Close #FileNum
MsgBox "Done!"
End Sub
This code can get me info in this format:
<event date="2002-05-16" time="11:00:00" value="0 flag="2"/>

But I'm missing something because I want:

<event date="2002-05-16" time="11:00:00" value="0" flag="2"/>
Note the " after the value number. I can't get this " anyhow! Can someone help me?