+ Reply to Thread
Results 1 to 3 of 3

How to remove inverted commas in PIPE Delimitted file created from VBA

  1. #1
    Registered User
    Join Date
    05-27-2014
    Posts
    13

    How to remove inverted commas in PIPE Delimitted file created from VBA

    Hi All,

    i have a Macro, its creating unwanted inverted commas at the start and end of the File.can someone please have a look?


    File:

    "SunilManual|123456790|DrivingLicence|908567543|Sunil|Manchan|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|ww|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|55|55||4|SR-1161||1234567890"

    Expected File:

    |SunilManual|123456790|DrivingLicence|908567543|Sunil|Manchan|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|ww|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|55|55||4|SR-1161||1234567890|

    VBA:

    Option Explicit

    Sub txtt_export()
    Dim buf As String, col As Long, r As Long, ws As Worksheet

    Set ws = ActiveSheet

    Open "D:\Temp\PEGAFileRequest.txt" For Output As #1
    For r = 2 To ws.UsedRange.Rows.Count
    For col = 1 To ws.UsedRange.Columns.Count
    If col = ws.UsedRange.Columns.Count Then
    buf = buf & "|" & ws.Cells(r, col).Text
    Else
    buf = buf & "|" & ws.Cells(r, col).Text & ","
    End If
    Next col
    Write #1, Mid(Replace(buf, ",", ""), 2)
    buf = ""
    Next r
    Close #1
    End Sub

    Thanks in advance,
    Sesgiri.

  2. #2
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: How to remove inverted commas in PIPE Delimitted file created from VBA

    hello, sesgiri
    plz take a movement to read forum rules, use code tags http://www.excelforum.com/forum-rule...es.htmlhttp://
    Use Code-Tags for showing your code :
    Please mark your question Solved if there has been offered a solution that works fine for you
    If You like solutions provided by anyone, feel free to add reputation using STAR *

  3. #3
    Registered User
    Join Date
    05-27-2014
    Posts
    13

    Re: How to remove inverted commas in PIPE Delimitted file created from VBA

    Sorry Sid, unable to see your code.

    thanks,
    Sesgiri

+ 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. Urgent!! Macro to copy Data from Excel and creates Pipe Delimitted Txt file.
    By sesgiri in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-29-2014, 10:09 AM
  2. How to stop inverted commas during copy
    By jediknight in forum Excel General
    Replies: 4
    Last Post: 10-22-2012, 01:45 AM
  3. Replies: 0
    Last Post: 09-10-2007, 10:22 AM
  4. how to stop excel from adding extra inverted commas?
    By podcast in forum Excel General
    Replies: 1
    Last Post: 07-27-2007, 06:49 PM
  5. How do I import a pipe delimited file with text that contains a few commas?
    By john928 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2005, 09:53 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