I have been looking all over for an answer to this issue. It seems like it should be a relatively simple fix but I'm not sure what I'm missing here.
The outcome should be the user selects a file from a folder (PickFile is a function that does that). Then from that selected file it will open that word doc, copy all of it's contents and paste it into DocText field in the form.
Any help or push in the right direction would be really appreciated. I've been looking all over but nothing I've found has worked.
Private Sub Updatebtn_Click()
Dim FName As String
Dim WordApp As Object
Dim WordDoc As Object
Dim WordRng As Object
Dim s As String
'Add new SOP Doc
s = PickFile("\\page\data\NFInventory\groups\CID\SOPs\", False, True)
If s <> "" Then FileName = s
'Update SOP Doc Text
StatusBox = ""
doctxt = ""
FName = "\\page\data\NFInventory\groups\CID\SOPs\" & FileName
'Status "Loading SOP..."
Set WordApp = CreateObject("Word.Application")
WordApp.Visible = True
'Status "Opening SOP..."
Set WordDoc = WordApp.Documents.Open(FName)
'Status "Copying Text..."
Set WordRng = WordDoc.Range(1)
WordRng.WholeStory
WordRng.Copy
'Status "Pasting Text..."
DocText.SetFocus
DoCmd.RunCommand acCmdPaste ' <----error
Nametxt.SetFocus
If IsNull(Nametxt) Then Nametxt = Left(doctxt, 10)
'Status "Closing Word..."
WordDoc.Close False
WordApp.Quit False
'Status "Done"
Set WordApp = Nothing
Set WordDoc = Nothing
Set WordRng = Nothing
End Sub