Hi,
I am continiously receiving the following error messge 'Microsoft Excel is waiting for another application to complete an OLE action' though no other application is open.
The problem occurs when Excel tries to launch Word, specifically this code:
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
This leads to a pause of about 1 minute, followed by the error message 'Microsoft Excel is waiting for another application to complete an OLE action'. Word does NOT launch and the user has no choice but to kill all processes.
Actual code in Excel VB-Script:
' -- Copies a specific fixed range from Excel
Range("A1:C48").Copy
'-- Opens Word
ActiveWorkbook.Windows(1).Caption = ActiveWorkbook.FullName
filename = ActiveWorkbook.FullName
lenfile = Len(filename)
wordfilename = Left(filename, (lenfile - 3)) + "doc"
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
With wrdDoc
wrdApp.Selection.Paste
If Dir(wordfilename) <> "" Then
Kill wordfilename
End If
.SaveAs (wordfilename)
.Close ' close the document
wrdApp.Documents.Open (wordfilename) 'Reopening word doc
Set wrdDoc1 = wrdApp.Documents.Open(wordfilename)
wrdDoc1.Activate
wrdDoc1.Tables(1).Rows.Alignment = wdAlignRowCenter 'Aligning Word doc
wrdDoc1.Save
End With
wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
How to resolve this problem?
Bookmarks