ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   transforming excel cell contents in word document, with coma separated. (https://www.excelbanter.com/excel-programming/367401-transforming-excel-cell-contents-word-document-coma-separated.html)

roshinpp_77[_13_]

transforming excel cell contents in word document, with coma separated.
 

transforming excel cell contents in word docum:confused: ent, with coma
separated.

Hi members,
It will be nice if anybody could tell me how to copy cell
contents..(eg: From A1,A2,A3,A4,A5 etc..downwards )to word document in
the format contents of A1,A2,A3,A4,a5.

I know how to transform a certain range of cells from excel to word in
the same(ie.as tables itself) form, but how to change the format with
coma separation.

TIA

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=562026


RB Smissaert

transforming excel cell contents in word document, with coma separated.
 
Show me your code that copies the range and I will show how to copy the
values.

RBS

"roshinpp_77"
wrote in message
...

transforming excel cell contents in word docum:confused: ent, with coma
separated.

Hi members,
It will be nice if anybody could tell me how to copy cell
contents..(eg: From A1,A2,A3,A4,A5 etc..downwards )to word document in
the format contents of A1,A2,A3,A4,a5.

I know how to transform a certain range of cells from excel to word in
the same(ie.as tables itself) form, but how to change the format with
coma separation.

TIA

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=562026



roshinpp_77[_14_]

transforming excel cell contents in word document, with coma separated.
 

Hi friend,
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


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


RB Smissaert

transforming excel cell contents in word document, with coma separated.
 
Sub cmdcopytoword_Click()

Dim i As Long
Dim arr
Dim strRange As String

strRange = Range("rpp").Cells(1)

If Range("rpp").Cells.Count 1 Then
arr = Range("rpp")
For i = 2 To UBound(arr)
strRange = strRange & "," & arr(i, 1)
Next
End If

Cells(1) = strRange
Cells(1).Copy

' 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

End Sub


RBS


"roshinpp_77"
wrote in message
...

Hi friend,
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


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



roshinpp_77[_16_]

transforming excel cell contents in word document, with coma separated.
 

Thanks RB Smissaert ,
but still another problem arised in between.
Your modification is working perfectly for small numbers.But for me
each cell is a 6 digit number and it is going for 50 to 60 cells.ie.

100001
122200
233333
133444
345566
......
...
upto 50 lines
So when i open the word file i am getting the output as
"#############".
Even in the cell(1) of excel sheet i am not able to set a correct
format that shows me 100001,122200,......

Your suggestion is awaited,

TIA
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=562026


roshinpp_77[_17_]

transforming excel cell contents in word document, with coma separated.
 

Thanks friend..i got it.
Instead of Cells(1), i gave Cells(1,1) and now its working perfectly.

Once again
Thanks a lot.

regards
Roshi

--
roshinpp_7
-----------------------------------------------------------------------
roshinpp_77's Profile: http://www.excelforum.com/member.php...fo&userid=3492
View this thread: http://www.excelforum.com/showthread.php?threadid=56202


RB Smissaert

transforming excel cell contents in word document, with coma separated.
 
If it works then fine, but there is absolutely no difference (that I know
of) between Cells(1) and Cells(1, 1)

RBS

"roshinpp_77"
wrote in message
...

Thanks friend..i got it.
Instead of Cells(1), i gave Cells(1,1) and now its working perfectly.

Once again
Thanks a lot.

regards
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=562026




All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com