Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default how to export a column as text separated by comma?

Hello I am new in excel 2007,
how i can export a column of one excel file into text objects
separated by comma?
For example if i have:
column1 = a b c d e f

how i can obtain a text like this?

data = a,b,c,d,e,f

Thanks, you can contact me also by email.
Dino.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default how to export a column as text separated by comma?

Sub WriteColumn()

Const Folder = "C:\temp\test"

Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

Set fswrite = CreateObject("Scripting.FileSystemObject")

WriteCol = "A"
'open files
ChDir (Folder)
FName = Application.GetSaveAsFilename( _
fileFilter:="Text Files (*.txt), *.txt")

If FName < False Then
fswrite.CreateTextFile FName
Set fwrite = fswrite.GetFile(FName)
Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault)
LastRow = Range(WriteCol & Rows.Count).End(xlUp).Row
OutputLine = ""
For RowCount = 1 To LastRow
If OutputLine = "" Then
OutputLine = Range(WriteCol & RowCount)
Else
OutputLine = OutputLine & "," & Range(WriteCol & RowCount)
End If
Next RowCount
tswrite.Close
End If
End Su

" wrote:

Hello I am new in excel 2007,
how i can export a column of one excel file into text objects
separated by comma?
For example if i have:
column1 = a b c d e f

how i can obtain a text like this?

data = a,b,c,d,e,f

Thanks, you can contact me also by email.
Dino.

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default how to export a column as text separated by comma?

Dino

Use text to columns, with fixed width, separate each character. Then
save as a csv file. When you open it in a text editor it may have
some trailing commas if all the strings in your column do not have the
same number of characters. In the text editor you should be able to
replace ,, wtih nothing.

Good luck.

Ken
Norfolk, Va

On Apr 18, 3:45*am, wrote:
Hello I am new in excel 2007,
how i can export a column of one excel file into text objects
separated by comma?
For example if i have:
column1 = a *b *c *d *e *f

how i can obtain a text like this?

data = a,b,c,d,e,f

Thanks, you can contact me also by email.
Dino.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default how to export a column as text separated by comma?

Please re-read the request. Your answer isn't consistant with the request.

"Ken" wrote:

Dino

Use text to columns, with fixed width, separate each character. Then
save as a csv file. When you open it in a text editor it may have
some trailing commas if all the strings in your column do not have the
same number of characters. In the text editor you should be able to
replace ,, wtih nothing.

Good luck.

Ken
Norfolk, Va

On Apr 18, 3:45 am, wrote:
Hello I am new in excel 2007,
how i can export a column of one excel file into text objects
separated by comma?
For example if i have:
column1 = a b c d e f

how i can obtain a text like this?

data = a,b,c,d,e,f

Thanks, you can contact me also by email.
Dino.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default how to export a column as text separated by comma?

Hi
You can do Edit, Find, Replace on the column to find " " (put a space
bar in the Find box) and replace with "," (put a , in the Replace
box).
regards
Paul

On Apr 18, 8:45*am, wrote:
Hello I am new in excel 2007,
how i can export a column of one excel file into text objects
separated by comma?
For example if i have:
column1 = a *b *c *d *e *f

how i can obtain a text like this?

data = a,b,c,d,e,f

Thanks, you can contact me also by email.
Dino.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default how to export a column as text separated by comma?

How did you dimension the variables.

What I used didn't work:

Dim fswrite As Object
Dim WriteCol As String
Dim Fname As Boolean

Dim fwrite As Object
Dim tswrite As Object
Dim lastrow As String
Dim outputline As String
Dim rowcount As Long
Reply
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
text string separated by comma Atishoo Excel Discussion (Misc queries) 6 February 12th 09 05:19 PM
How do I convert a column of numbers into comma separated values . cattom44 Excel Worksheet Functions 2 August 3rd 07 09:48 PM
Turning column contents into text list separated by a comma Kevin Rhinehart Excel Discussion (Misc queries) 1 January 16th 07 07:00 AM
How do I export data from Excel as a series of comma-separated val gbergren New Users to Excel 2 January 20th 06 08:17 PM
Going from column to comma separated list... jmboggiano Excel Discussion (Misc queries) 1 March 10th 05 04:30 PM


All times are GMT +1. The time now is 11:16 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"