0
votes

I developed a small program in VBA Excel. It was a good start however I adjusted some presets -- a website recommended this as would be pulling text from MS Word. I stripped out all of the code I was working on to the following:

Function FnOpeneWordDoc()

   Dim objWord

   Dim objDoc

   Set objWord = CreateObject("Word.Application")

   Set objDoc = objWord.Documents.Open("C:\Users\Filepath\Example1.docx")

   objWord.Visible = True

End Function

It opens a Word document referenced in the task manager, but not from the interface.

The program above hangs for a while and returns a the following:

Microsoft Office Excel is waiting for another application to complete an OLE action.

Finally the run stops and I end up with Run-Time Error '-2147023170 (800706be)': Automation The Remote call failed.

*I've tried all the basic tricks such as shutting down all instances of Excel and Word.

1
Try making the Word instance visible before trying to open the file.Tim Williams
Here is a similar thread you may get ideas from. VBA: open word from excelDavesexcel

1 Answers

2
votes

You should add objword.Visible = True right after Set objWord = CreateObject("Word.Application")