bigjaker
02-11-2009, 02:18 PM
I have a table that I go to in another document (document2) and select a range of cells, then they are copied and the active document is closed. Next I go to a spot in another open word document, in a table that is the same size.
The problem I am having is that I can't get the paste to work correctly. I need basically a "paste cells" I use it in the edit menu all of the time, but how to I make it work in VBA?
Below is a small snippet of my vba I am using and problem is at the bottom.
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCell, Count:=3
Selection.MoveDown Unit:=wdLine, Count:=24, Extend:=wdExtend
Selection.Copy
ActiveWindow.Close 'closes document2
Selection.GoTo What:=wdGoToTable, Which:=wdGoToFirst, Count:=3, Name:=""
Selection.Find.ClearFormatting
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCell, Count:=3
Selection.MoveDown Unit:=wdLine, Count:=24, Extend:=wdExtend
Selection.Paste 'want to paste cells
Any help would be appreciated.
Jake
The problem I am having is that I can't get the paste to work correctly. I need basically a "paste cells" I use it in the edit menu all of the time, but how to I make it work in VBA?
Below is a small snippet of my vba I am using and problem is at the bottom.
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCell, Count:=3
Selection.MoveDown Unit:=wdLine, Count:=24, Extend:=wdExtend
Selection.Copy
ActiveWindow.Close 'closes document2
Selection.GoTo What:=wdGoToTable, Which:=wdGoToFirst, Count:=3, Name:=""
Selection.Find.ClearFormatting
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.MoveRight Unit:=wdCell, Count:=3
Selection.MoveDown Unit:=wdLine, Count:=24, Extend:=wdExtend
Selection.Paste 'want to paste cells
Any help would be appreciated.
Jake