Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 1st, 2007, 04:57 AM
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


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 ?

Reply With Quote
  #2 (permalink)  
Old October 1st, 2007, 01:43 PM
Registered User
Join Date: Oct 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

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


Reply With Quote
  #3 (permalink)  
Old October 1st, 2007, 02:30 PM
Friend of Wrox
Join Date: Oct 2003
Location: , , Finland.
Posts: 168
Thanks: 0
Thanked 0 Times in 0 Posts


That was the trick. Thank you.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 kf9thdon@aol.com 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

All times are GMT -4. The time now is 02:20 AM.

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