ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copy excel cell to cell in word table using excel macro (https://www.excelbanter.com/excel-discussion-misc-queries/100616-copy-excel-cell-cell-word-table-using-excel-macro.html)

jthurnwps

copy excel cell to cell in word table using excel macro
 
I have a macro in excel that copies a cell, opens a word document, moves the
cursor to a specific location, then pastes what was copied. After that it
goes to a new location in the word document (which is in a table), goes back
to the excel spreadsheet which is still active, copies a new cell then
returns to the word document to paste that. So far I have tried numerous
coding to get the data to paste but it hasn't happened. Can someone please
tell me what I am doing wrong?
Here is the code:

Range("A1").Select
Selection.Copy
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open("Mydoc.doc")
wrdApp.Visible = True
wrdApp.Selection.MoveDown Unit:=wdLine, Count:=2
wrdApp.Selection.MoveRight Unit:=wdCharacter, Count:=45Windows
wrdApp.Selection.PasteAndFormat (wdPasteDefault)
wrdApp.Selection.MoveUp Unit:=wdLine, Count:=9
Windows("Myexcel").Activate
Range("A4").Select
Selection.Copy
wrdApp.Selection.PasteExcelTable False, False, False


All times are GMT +1. The time now is 08:33 AM.

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