Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 1st, 2007, 04:57 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exporting cell values to text file


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

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

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

Any ideas ?

Old October 1st, 2007, 01:43 PM
Registered User
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

See if this helps: http://www.microsoft.com/technet/scr...5/hey0606.mspx


Old October 1st, 2007, 02:30 PM
Friend of Wrox
Join Date: Oct 2003
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts


That was the trick. Thank you.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate Exporting data to text file if new record NC_Juggler Access VBA 1 November 21st, 2008 04:35 PM
c# and Excel cell values hardboiled C# 0 November 16th, 2007 11:12 AM
Exporting report to text file naruto-kun Reporting Services 0 August 15th, 2006 10:54 PM
Text file import to data grid missing some values [email protected] ASP.NET 1.0 and 1.1 Basics 2 April 14th, 2006 10:42 AM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.