![]() |
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 01:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com