+ Reply to Thread
Results 1 to 3 of 3

writing to a text file without quoatations

Hybrid View

  1. #1
    Registered User
    Join Date
    09-30-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    78

    writing to a text file without quoatations

    This code I am using writes cell data to a text file starting from A1 and going down the column. Each line/row is written in quotes. How can I disable or replace the quotes with blanks in the text file?

    Here is the code:

    Sub Generate()
    '
    ' Generate Macro
    '
    ' Keyboard Shortcut: Ctrl+t
    '
    
    Dim flag As Boolean
    Dim i As Integer
    'open the file for writing
    Open "C:\Temp\Test.txt" For Output As #1
    flag = True
    i = 1
    'keeps going until the end of the file is reacheed
    While flag = True
        'check if the current cell has data in it
        If Cells(i, 1) <> "" Then
            'write the data to the file
            Write #1, Cells(i, 1)
            'go to next cell
            i = i + 1
        Else
            'if the last row has been reached exit the loop
            flag = False
        End If
    Wend
    'close the file
    Close #1
    
    End Sub

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,470

    Re: writing to a text file without quoatations

    Maybe try Print instead of Write.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,470

    Re: writing to a text file without quoatations

    Thanks for the rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] writing to text file recommendations?
    By nerdzkilla in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-07-2012, 11:10 AM
  2. Writing text to a file
    By fabb2004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2010, 08:20 PM
  3. Problem with writing to text file from VBA
    By Shane O in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2010, 10:44 AM
  4. Writing results to a text file
    By cameronyoung in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-22-2009, 10:54 AM
  5. Writing to a text file
    By scantor145 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-30-2005, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1