Hi All,
I have the below code to export the Excel data in Text format and its working fine, Currently it is using Comma as delimiter whereas I need Tab as delimiter.
Can anyone please help me out, I am new to Excel Macro's.
Thanks in Advance.
Om
![]()
Sub CSVFile() Dim SrcRg As Range Dim CurrRow As Range Dim CurrCell As Range Dim CurrTextStr As String Dim ListSep As String Dim FName As Variant FName = Application.GetSaveAsFilename("", "Txt File (*.txt), *.txt") ListSep = Application.International(xlListSeparator) If Selection.Cells.Count > 1 Then Set SrcRg = Selection Else Set SrcRg = ActiveSheet.UsedRange End If Open FName For Output As #1 For Each CurrRow In SrcRg.Rows CurrTextStr = мо For Each CurrCell In CurrRow.Cells CurrTextStr = CurrTextStr & """" & CurrCell.Value & """" & ListSep Next While Right(CurrTextStr, 1) = ListSep CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1) Wend Print #1, CurrTextStr Next Close #1 End Sub











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks