Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default starting Word from an Excel macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default starting Word from an Excel macro

Russ,

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

Mike

"Russ" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default starting Word from an Excel macro

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

On Mon, 23 Nov 2009 09:10:02 -0800, Russ
wrote:

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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default starting Word from an Excel macro

What version of excel are you using?

Russ wrote:

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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need macro that delete rows starting with specified letter/word andrei Excel Programming 2 September 27th 09 02:49 PM
keyboard is locked after starting in both word and excel kfaul Excel Discussion (Misc queries) 0 November 18th 08 03:48 PM
Starting Word from Excel AndyC812 Excel Programming 2 June 14th 08 05:57 PM
how to keep a word of same sentence starting w a capital next lin dottie Excel Worksheet Functions 1 September 20th 07 05:32 PM
Starting Excel from Word MichaelS_[_6_] Excel Programming 4 March 3rd 06 03:50 PM


All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"