ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting and copy from a word object in Excel (https://www.excelbanter.com/excel-programming/338396-inserting-copy-word-object-excel.html)

Alex Martinez

Inserting and copy from a word object in Excel
 

Hi,

I am using Excel 2002 and I insert a word object in my spreadsheet. What I
want to do is copy some text from the same spreadhseet below either from
Excel or from another word object and paste it into a word object at the
very top. (See below what I want to paste into the word object). I can do
this using a command button - macro, but How can I do this? Any tips will
be appreciated. Thank you.


Name
Classification
Area
Zone




michelxld[_28_]

Inserting and copy from a word object in Excel
 

Hello Alex

I'm not sure to understand but i hope this example help you



Dim WordApp As Object
Dim WordObj As Shape

Application.ScreenUpdating = False

'suppose Word Object is the first object in the sheet
Set WordObj = Worksheets(1).Shapes(1)
Set WordApp = WordObj.OLEFormat.Object.Object.Application

'goto the fist line in the Word Object
WordApp.Selection.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute,
Count:=1
'insert datas
WordApp.Selection.TypeText Text:="essai d'insertion" & vbLf &
Range("A1") & vbLf

Range("A1").Select
Application.ScreenUpdating = True



Regards ,
michel


--
michelxld
------------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367
View this thread: http://www.excelforum.com/showthread...hreadid=399354



All times are GMT +1. The time now is 06:22 AM.

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