starting Word from an Excel macro

R

Russ

I found this piece of code by Bob Phillips that opens a Word document from
within an Excel macro.
Dim oWord as Object
Dim oDoc as Object

Set oWord = CreateObject("Word.Application")
oWord.Visible = True

Set oDoc = oWord.Documents.Open("C:\personal\bob\personal\CV - RP
(short).doc")

It works fine but it also closes the Excel file that contains the macro. Is
there a way to prevent the Excel file from closing?
 
M

Mike H

Russ,

There's nothing in that snippet that will close the Excel Application. I
think you need to post all your code.

Mike
 
G

Gord Dibben

Nothing I can see in that code would cause Excel or the workbook to close.

Lose focus, yes, close, no.

At least not in my testing.


Gord Dibben MS Excel MVP
 
D

Dave Peterson

What version of excel are you using?
I found this piece of code by Bob Phillips that opens a Word document from
within an Excel macro.
Dim oWord as Object
Dim oDoc as Object

Set oWord = CreateObject("Word.Application")
oWord.Visible = True

Set oDoc = oWord.Documents.Open("C:\personal\bob\personal\CV - RP
(short).doc")

It works fine but it also closes the Excel file that contains the macro. Is
there a way to prevent the Excel file from closing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top