I am running a code that will copy and paste a piece of data into a specific location of a selected file. This is what I have so far
The debugger identified the "myfile" after the copy as the cause for this. Does it want me to specify where in the document to put it? if so how do I do that?
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 myfile
If Range("L2") <= 19 And Range("L2") >= 0 Then Range("J2").Copy myfile
If Range("L2") <= -1 And Range("L2") >= -30 Then Range("j2").Copy myfile
End Sub