Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| 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 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
  #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

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
  #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
Default

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

--



  #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
Default

Hi,

That was the trick. Thank you.

-vemaju


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





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