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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|