LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Urgent info. on opening a mail merge with the datasource open

There is a great lag in opening these documents. Read the
information below.

This is opening another spreadsheet and closing the
current one that will allow me to run the 2nd macro.

Sub Rectangle1_Click()
Workbooks.Open ("H:\Created Projects\Excel\xxxxx\To get
doc open.xls")
Workbooks("xxxxx.xls").Activate
ActiveWorkbook.Close (Yes)
End Sub


This is where it's taking a long time to open the word
doc. (that's merged) and the excel spreadsheet with the
merged data.

Sub Open_RetentionDoc()
Dim appWD As Object
Dim wdDoc As Document
Set appWD = CreateObject("Word.Application")
appWD.Visible = True
appWD.ChangeFileOpenDirectory ActiveWorkbook.Path
appWD.Documents.Open Filename:="H:\Created
Projects\Word\xxxxx\xxxxx Project\letters\xxxxx Letter.doc"
Set wdDoc = appWD.ActiveDocument
ActiveWorkbook.Close (No)
End Sub

This is the macro that sends the merged information to a
new document and closes the mail merged doc. How can I
keep the excel spreadsheet open at this point? When I
have the merged doc. to close it automatically closes the
spreadsheet, too.

docname = ActiveDocument.MailMerge.DataSource.DataFields
("Name").Value

x = ActiveDocument.MailMerge.DataSource.DataFields
("Records").Value
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord =
ActiveDocument.MailMerge.DataSource.ActiveRecord
.LastRecord =
ActiveDocument.MailMerge.DataSource.ActiveRecord
End With
.Execute Pause:=False
End With


Documents("xxxxx Letter.doc").Close (Yes)
ActiveDocument.Close (Yes)
Application.Quit
End Sub

 
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
Problem opening up current Excel wksht to mail merge in Word Preciouskisz Excel Discussion (Misc queries) 0 January 8th 10 08:53 PM
Unable to open Excel file/Mail Merge Marie Excel Discussion (Misc queries) 2 October 16th 09 06:37 PM
When I open an excel workbook to mail merge nothing is shown vanessa Excel Worksheet Functions 0 September 7th 07 05:32 AM
Mail merge with header/field info in 3rd row Julie Excel Discussion (Misc queries) 2 December 12th 06 11:04 PM
Mail merge (Word97) only importing 1st 85 rows of info from Excel Kali Carringer Excel Discussion (Misc queries) 3 March 26th 05 05:33 AM


All times are GMT +1. The time now is 12:30 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"