starting Word from an Excel macro

  • Thread starter Thread starter Russ
  • Start date Start date
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?
 
Russ,

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

Mike
 
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
 
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?
 
Back
Top