Hi
A programmer kindly wrote this code for me. However, I keep getting this error
Microsoft Excel is waiting for another application to complete an OLE
I stepped throught the procedure and find it happens at this point:
With WordApp.Documents.Open(Filename:="C:\Documents and Settings\ii36250\My Documents\LateToRQ_Documentation.docx", ReadOnly:=False)
Please could someone help me with this.
Sub copy_word_2_xl()
Dim WordApp As Object, rng As Object
'Open Word
Set WordApp = CreateObject("Word.application")
WordApp.Visible = True
With WordApp.Documents.Open(Filename:="C:\Documents and Settings\ii36250\My Documents\LateToRQ_Documentation.docx", ReadOnly:=False)
'Refer to the WordApp objct to write to word from excel
Set rng = WordApp.Selection.Range
rng.wholestory
rng.Copy
ThisWorkbook.Sheets(1).[a1].Select
ActiveSheet.Paste
'Close Word
.Close
'WordApp.Quit
WordApp.Quit
'Set WordApp = Nothing
Set workapp = Nothing
Set rng = Nothing
End With
End Sub
A programmer kindly wrote this code for me. However, I keep getting this error
Microsoft Excel is waiting for another application to complete an OLE
I stepped throught the procedure and find it happens at this point:
With WordApp.Documents.Open(Filename:="C:\Documents and Settings\ii36250\My Documents\LateToRQ_Documentation.docx", ReadOnly:=False)
Please could someone help me with this.
Sub copy_word_2_xl()
Dim WordApp As Object, rng As Object
'Open Word
Set WordApp = CreateObject("Word.application")
WordApp.Visible = True
With WordApp.Documents.Open(Filename:="C:\Documents and Settings\ii36250\My Documents\LateToRQ_Documentation.docx", ReadOnly:=False)
'Refer to the WordApp objct to write to word from excel
Set rng = WordApp.Selection.Range
rng.wholestory
rng.Copy
ThisWorkbook.Sheets(1).[a1].Select
ActiveSheet.Paste
'Close Word
.Close
'WordApp.Quit
WordApp.Quit
'Set WordApp = Nothing
Set workapp = Nothing
Set rng = Nothing
End With
End Sub