Copying from excel cell to specific Word

klutch

New Member
Joined
Jun 7, 2018
Messages
38
Hello, I am trying to copy a cell from excel into a specific line within a file I open with my code.
Code:
Sub CopyandPaste()
Dim myfile
myfile = Application.GetOpenFilename(, , "Browse for Document")
Dim wdapp As Word.Application
Set wdapp = CreateObject("Word.Application")
wdapp.Visible = True
Dim wddoc As Word.document
Set wddoc = wdapp.Documents.Open(myfile)
 If Range("L2") <= 30 And Range("L2") >= 20 Then Range("j2").Copy Range("s2")
If Range("L2") <= 19 And Range("L2") >= 0 Then Range("J2").Copy Range("s2")
If Range("L2") <= -1 And Range("L2") >= -30 Then Range("j2").Copy Range("s2")
Range("s2").Select
Selection.Copy
End Sub
as you can see, my code stops after I select the cell I wish to copy. I am not sure of the code to select the word doc I previously opened and then paste it.
I am trying to paste it in the 3rd section of a table on line 10 of page 5.
Is anyone familiar with this?
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Watch MrExcel Video

Forum statistics

Threads
1,108,731
Messages
5,524,507
Members
409,584
Latest member
RedHelp

This Week's Hot Topics

Top