Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Excel error

Status
Not open for further replies.

W1ordvba

Technical User
Dec 12, 2011
7
GB
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
 
See my reply in your other thread.

When posting follow-up queries regarding help already given, please post a reply in the existing thread rather than starting a new one.

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top