Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Excel 2003 as DataSource problem
I walked through the MS training of the mail merge process on how to
use the toolbar, and it seemed (and originally was) pretty straight- forward. My actual objective was to create a way to merge ONE row of Excel data (not mailing fields but custom fields) with ONE Word document, via a macro. I needed to do it manually before I could record the macro. The idea was I could pick a row, copy it into my DataSource Sheet2$ and then execute my macro in Word. I went through the toolbar, left to right. Set the document type as NORMAL, connected to the DataSource, choosing the Sheet2$ of the spreadsheet as the actual DataSource, added my fields, clicked Merge to New Document, and it worked as advertised. So far so good. So I recorded this macro in Word: Sub Grabbitt() 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 Selection.WholeStory Selection.Copy End Sub Pretty simple, right? The macro worked the first time, but when I copied a new row into Sheet2$ and saved the Excel sheet, re-executing the macro did not pick up the new row. I assumed that was because no re-querying of the DataSource took place. So I looked around with the Object Browser to find a method of the DataSource object that would refresh its query; to no avail. I want to avoid closing and opening the Merge Document, because that entails too much time and turns my time-saving macro into a time waster. What should I do? That's the first question. Please, if time permits, read on... Problem 2 occurred after I tried to reopen all the documents after a restart on my system. This time, upon trying to reopen the Merge Document, it reported it could not locate its DataSource. Nothing had moved. I tried detaching the DataSource (one of the options in the error dialog for the "could not locate" error). Now, upon attempting to reattach, I navigated to the spreadsheet, chose Sheet2$, but now it wants me to SELECT TABLE, off of a blank ListBox. (nothing to Select). So now, I cannot get my DataSource reattached. It never presented that dialog the first time around. What causes this and how do I get past it and reselect my DataSource, and why couldn't it find it in the first place? Any help on these two related issues would be greatly appreciated. It's all Office 2003 Professional SP3 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mail Merge and Excel Datasource | Mailmerge | |||
Mailmerge from Excel Datasource | Mailmerge | |||
Editing an Excel DataSource | Mailmerge | |||
Excel datasource | Mailmerge | |||
Problem with repeated access to the datasource (Excel Spreadsheet) | Mailmerge |