ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy text from excel and paste in word - Urgent Help (https://www.excelbanter.com/excel-programming/363251-copy-text-excel-paste-word-urgent-help.html)

sippy

Copy text from excel and paste in word - Urgent Help
 

Hi,
I am copying range of text from Excel. I need to open a word document
and then find a text and replace that text with the copied text from
the excel. I am doing something like this.

lsValue="<*Text"
Set TheRange = rLoopCells.Offset(1, 0).Resize(lsRowValue,
lsColumnValue)
TheRange.Select
TheRange.Copy
'Find the text and paste the copied text
With moDocument.ActiveWindow .Document.Content.Find.Text = lsValue
'.Selection.Find.ClearFormatting
'.Selection.Find.Forward = True
'.Selection.Find.Text = lsValue '.Selection.Find.Execute
'If .Selection.Find.Execute(lsValue) Then If
..Document.Content.Find.Execute(lsValue) Then .Selection.PasteSpecial
MsgBox "Found"
End If
End With

But I am unsuccessful. Any help would be greatly appreciated.

Thanks in advance.
Sanjay.


--
sippy
------------------------------------------------------------------------
sippy's Profile: http://www.excelforum.com/member.php...o&userid=35084
View this thread: http://www.excelforum.com/showthread...hreadid=548346



All times are GMT +1. The time now is 12:43 PM.

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