title: How to write to a file using comma delimiter and no double quote in string?
body: <p>I would like to print a range of date into .txt file with some special header so that a special software called Prophet could recognize. </p>
  
  <pre><code>Sub Export_TEST()
  Dim myFile As String, rng As Range, cellValue As Variant, i As Integer, j As Integer
  Dim prophetheader As String
  Dim prophetlineheader As String
  myFile = Application.DefaultFilePath &amp; "\" &amp; "test" &amp; ".txt"
  Set rng = Selection
  
  prophetheader = "!1"
  Open myFile For Output As #1
  Print #1, rng.Columns.Count - 1
  
  For i = 1 To rng.Rows.Count
      For j = 1 To rng.Columns.Count
          cellValue = rng.Cells(i, j).Value
          If j = rng.Columns.Count Then
              Print #1, cellValue
          ElseIf i = 1 And j = 1 Then
              Print #1, prophetheader, cellValue,
          ElseIf j = 1 Then
              Print #1, "*", cellValue,
          Else
              Print #1, cellValue,
          End If
      Next j
  Next i
  Close #1
  
  End Sub
  </code></pre>
  
  <p>The code is quite straight forward, just add * in the front of each line and add !1 in the column header. But I encounter the issue that the output file has been delimited using comma and no double quotation in the string. And I am in the dilemma that if I use write function, it will use comma as delimiter, but has double quotation on string and if I use Print, space as delimiter and no double quote on string.</p>
  
  <p>Is there a way to print the file using comma delimiter and no double quote on string?</p>
  
  <p>Below is the dummy data selection.</p>
  
  <p>SPCODE NAME</p>
  
  <p>1      JS</p>
  
  <p>And the output should be </p>
  
  <p>21 </p>
  
  <p>!1,SPCODE,NAME</p>
  
  <p>*,1,JS</p>