A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Merge from Excel - takes 1 min. to open the word document



 
 
Thread Tools Display Modes
  #1  
Old September 29th, 2009, 03:58 PM posted to microsoft.public.word.mailmerge.fields
Alex St-Pierre
external usenet poster
 
Posts: 4
Default Merge from Excel - takes 1 min. to open the word document

Hi!
I have a macro in Excel (not the datasource of the mailmerge) that open
Word documents. It takes 1-2 minutes to open the word document (mailmerge)
since it is linked to an excel datasource (using DDE method). If the same
macro that open the word document is run from Word, it takes 2 seconds to
open the same document. Any idea?

Dim appWord as Word.Application
Dim docWord as Word.Document
Set appWord = New Word.Application
Set docWord = appWord.Documents.Open("V:\file.doc") 'Takes 1-2 min..

Thank you!
Alex
--
Alex St-Pierre
  #2  
Old September 29th, 2009, 05:42 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default Merge from Excel - takes 1 min. to open the word document

1. When I run the macro from Excel, I get one more instance of EXCEL.EXE
than when I run the macro from Word. It is possible that starting a new
instance could d=cause a problem, particularly if your copy of Excel
runs startup code, but here, Excel startup is quite fast. So...

2. ...my guess is that
a. the delay is because Word first tries to make a connection with the
existing instance of Excel, but cannot. Perhaps Excel blocks inbound DDE
conversations when it is running a macro? (It does not seem to mae a
difference whether you are actually running the macro from the VBA
editor or using e.g. Tools-Macros, with the VB Editor closed.)
b. What probably happens is that Word tries to connect, does not
receive an immediate response from Excel, waits, and eventually times
out and creates a new instance of Excel instead.

Unfortunately, even if that is a correct analysis, I don't see any way
to avoid the situation, except "avoid making this type of connection
when automating a Word document from Excel".

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

Alex St-Pierre wrote:
Hi!
I have a macro in Excel (not the datasource of the mailmerge) that open
Word documents. It takes 1-2 minutes to open the word document (mailmerge)
since it is linked to an excel datasource (using DDE method). If the same
macro that open the word document is run from Word, it takes 2 seconds to
open the same document. Any idea?

Dim appWord as Word.Application
Dim docWord as Word.Document
Set appWord = New Word.Application
Set docWord = appWord.Documents.Open("V:\file.doc") 'Takes 1-2 min..

Thank you!
Alex

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.