View Single Post
  #1 (permalink)  
Old October 1st, 2007, 04:57 AM
vemaju vemaju is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: , , Finland.
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exporting cell values to text file

Hi,

I have a table and I want to convert it to txt-file
I use this code and everything is fine

Sub WriteTxtFile()
Dim File As String
Dim FileNum As Integer


FileNum = FreeFile
'File = "C:\Sample\Output.tmp"
'*** Kill previous File
On Error Resume Next
Kill File
On Error GoTo 0

Open File For Append As #FileNum

    Write #FileNum, Sheets("Sheet1").Range("B11") & ", " & "Sheet1" & ", " & "B11"
    Write #FileNum, Sheets("Sheet1").Range("B12") & ", " & "Sheet1" & ", " & "B12"
    Write #FileNum, Sheets("Sheet1").Range("B13") & ", " & "Sheet1" & ", " & "B13"
Close #FileNum

End Sub

Result
"Test, Sheet1, B11"
"Test1, Sheet1, B12"
"Test2, Sheet1, B13"

Problem is that I want the result file without quotation marks (")

Any ideas ?



-vemaju
__________________
-vemaju