LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Add Column Names to VBA script


Please help me modify the script listed below to add the column names listed
beow to the first row in the test.csv file. These column names are different
from the input worksheet.

Please help me complete this task.

Thanks,


Column Names
1. Caller_Id
2. MT_Port
3. Noy_Number
4. Scheduled_Date_ETP
5. Tship
6. Parcel_Quantity





Sub WriteCSV()

Const Delimiter = ","
Const MyPath = "C:\temp\"

Set fswrite = CreateObject("Scripting.FileSystemObject")

WriteFileName = "text.csv"

'open files
WritePathName = MyPath + WriteFileName
fswrite.CreateTextFile WritePathName
Set fwrite = fswrite.GetFile(WritePathName)
Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault)

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For RowCount = 10 To LastRow
If Range("D" & RowCount) Date Then
For ColCount = 1 To 6
If ColCount = 1 Then
OutputLine = Cells(RowCount, ColCount)
Else
OutputLine = OutputLine & Delimiter & Cells(RowCount, ColCount)
End If
Next ColCount
tswrite.writeline OutputLine
End If
Next RowCount

tswrite.Close

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column Hidding Script not working chinny Excel Programming 2 May 13th 07 01:11 AM
Sort Column Script Bernie New Users to Excel 3 January 23rd 07 05:52 PM
Sort Column Script Bernie Excel Programming 0 January 22nd 07 03:35 PM
Change names of files in a folder to match names in Excel Column saybut Excel Programming 4 February 9th 04 06:26 PM
vb script to add names to tabs [email protected] Excel Programming 1 December 16th 03 09:40 PM


All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"