I\'ve got an Excel data range I need to be able to paste into a Word document template and save automatically using a macro from Excel.
Currently when it is run, it tell
First, you are getting a lock error because the instance of word is still running in the background and locking the file you are trying to re-open. You can verify that with the task manager. To avoid this error, you can either:
Or (best)
Write a function that either gets the word application running in the background or if none, creates a new one. This is the best option IMO, because you will not have the risk to have many invisible Word processes running in the background.
Private Function GetWordApp() As Word.Application
On Error Resume Next
Set GetWordApp = GetObject(, "Word.Application")
If GetWordApp Is Nothing Then Set GetWordApp = New Word.Application
End Function