I need to copy a specific item of text (one or a few words) from Word (2007) to Excel (2007) using an Excel macro, for multiple documents.
So far I have the Excel macro opening each Word document one at a time and locating the text adjacent to what I need.
I now need to:
- Move to an adjacent cell in a Word table. I'm thinking
wdApp.Selection.MoveLeft Unit:=wdCell
(orMoveRight
) where wdApp isWord.Application
- Copy the contents of the cell. I'm thinking
wdApp.Selection.Copy
and something likewdDoc.Word.Range
wherewdDoc
isWord.Document
but I can't select the whole cells contents. - Paste it into a variable in Excel. Here I don't know how to copy the clipboard to an Excel variable.
Updated to show searching for text and then selecting content relative to its location:
Then assign the variable TheContent to your required Excel range.