Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel column to word with coma separated!!


Hi members,
This is my macro for copying a range named "rpp" to a new word doc
generated in c:\autogenr.doc.



My input is:
col: C
1001
1002
1003
1004
1005
1006
1007

`my output in word has to be:
1001,1002,1003,1004,1005,1006,1007 etc..till the end


Below macro will copy the entire range as it is (as table) from excel
to doc.

Sub cmdcopytoword_Click()
'copy sheet to clipboard
Range("rpp").Select
Selection.Copy
Range("B3").Select

' open Word
Dim appWD As Object
Set appWD = CreateObject("Word.Application")
appWD.Visible = True

'open a new document in Word
appWD.Documents.Add DocumentType:=wdNewBlankDocument

' paste from clipboard
appWD.Selection.Paste
With appWD.ActiveDocument
..SaveAs "C:\autogenr.doc"
..Close
End With


But wha i require is not the entire range a table.but the contents of
single column with coma separated in word.

Please provide some inputs.

Regsrds,
Roshin


--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile: http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=562337

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default excel column to word with coma separated!!

Maybe you can retrieve the values into an array and then join them into one
string before writing to the document

Dim vTmp() As Variant
Dim sTmp As String
vTmp = Application.WorksheetFunction.Transpose(Range("rpp ").Value)
sTmp = Join(vTmp, ",")


"roshinpp_77" wrote:


Hi members,
This is my macro for copying a range named "rpp" to a new word doc
generated in c:\autogenr.doc.



My input is:
col: C
1001
1002
1003
1004
1005
1006
1007

`my output in word has to be:
1001,1002,1003,1004,1005,1006,1007 etc..till the end


Below macro will copy the entire range as it is (as table) from excel
to doc.

Sub cmdcopytoword_Click()
'copy sheet to clipboard
Range("rpp").Select
Selection.Copy
Range("B3").Select

' open Word
Dim appWD As Object
Set appWD = CreateObject("Word.Application")
appWD.Visible = True

'open a new document in Word
appWD.Documents.Add DocumentType:=wdNewBlankDocument

' paste from clipboard
appWD.Selection.Paste
With appWD.ActiveDocument
.SaveAs "C:\autogenr.doc"
.Close
End With


But wha i require is not the entire range a table.but the contents of
single column with coma separated in word.

Please provide some inputs.

Regsrds,
Roshin


--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile: http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=562337


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
what should happen after the coma (,) feature is applied in excel Sopart Excel Discussion (Misc queries) 1 May 10th 10 05:39 PM
How can I filter just 2 columns (separated by another column)? theglove33 Excel Worksheet Functions 2 July 29th 08 07:15 PM
transforming excel cell contents in word document, with coma separated. roshinpp_77[_13_] Excel Programming 6 July 18th 06 01:12 PM
Column with semicolon-separated values nsv[_10_] Excel Programming 3 February 22nd 06 12:22 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 12:08 AM.

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

About Us

"It's about Microsoft Excel"