Maybe this'll help:

Option Explicit
Private Sub ExportButton_Click()
Dim fHand As Long
Dim expCode As Range
Dim ExportName As String
Dim myStr As String

ExportName = "C:\my documents\excel\test.out"

fHand = FreeFile
Open ExportName For Output As fHand

Print #fHand, "[Example]" 'change this back
Print #fHand, "key_temp=";

myStr = ""
For Each expCode In Range("CodeRef").Cells
myStr = myStr & ";1," & Format(expCode.Value, "000000")
Next expCode

myStr = myStr & ";"
myStr = Mid(myStr, 2)
Print #fHand, myStr

Close fHand
End Sub


Cactus wrote:
>
> Please help me.
>
> I writen this VBA code for export range to Text file.
>
> --------
> Option Explicit
>
> Private Sub ExportButton_Click()
> Dim fHand As Long, expCode As Variant
>
> fHand = FreeFile
> Open ExportName For Output As fHand
>
> Write #fHand, TextBox 'TextBox included text "[Example]"
> Write #fHand, "key_temp="
>
> For Each expCode In Range(CodeRef)
> Write #fHand, 1, expCode
> Next expCode
>
> Close fHand
> End Sub
>
> --------
> I want export content should like this
>
> [Example]
> key_temp=1,000690;1,000063;1,000022;1,000829;0,600001;0,600005;0,000001;1,39
> 9001;
>
> --------
> But now is this.
>
> "[Example]"
> "key_temp="
> 1,"000633"
> 1,"000830"
> 1,"000056"
> 1,"000407"
> 1,"000806"
> 1,"000860"
> 1,"000881"
> 1,"000850"
> 1,"000928"
> 1,"000717"
>
> --------
> How to remove the quotation mark?
> how i export the ';' semicolon mark?
>
> Thanks a lot.


--

Dave Peterson