Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Alan[_8_] Alan[_8_] is offline
external usenet poster
 
Posts: 2
Default Delete mailmerge database record

In VBA I can move to the last record in a Word 2007 mailmerge datasource,
using
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdLastRecord
How can I delete this record ?




  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Delete mailmerge database record

Let's assume you mean exactly what you say, i.e. "delete this record" in
the data source rather than than merely "exclude the record from the
merge." (If you just want to do that then you may be able to navigate to
the record and set its Included property to False).

I think the only option you have is to delete the record in the data
source itself without using the Word object model. How to do that would
be very dependent on the data source (for example, for a standard data
source created within Word 2002 or later, the data source would be an
Access/Jet .mdb file that could in theory be modified using ADO or DAO;
for a Word data source you would have to locate and delete the
paragraph/table row that contained the record, and so on).

That may or may not be possible while Word has the data source open,
depending on the data source, and the deletion of the record may or may
not be reflected immediately in the list of records to be merged.

Unfortunately you can't delete the record using the DataSource object.

Although it is just about possible that you might be able to program the
Dialog box that Word uses in its interface, you'd have to work out which
dialog it is. It may one of the large number that are not documented in
the wdWordDialog enumeration. For example, it could be Dialog 1373. Then
you'd have to be able to control it programmatically. If for example I
do Dialogs(1373).Display, it is unpopulated.

Again, some of the earlier dialog boxes have "verbs"/method names that
correspond to some of their properties/buttons, but the best you can do
is experiment with the newer dialogs.

Finally, in this case you would also have to get the dialog box to
display or select the record you needed to delete, and that's probably
either difficult or impossible.


Peter Jamieson

http://tips.pjmsn.me.uk

On 29/01/2010 11:04, Alan wrote:
In VBA I can move to the last record in a Word 2007 mailmerge datasource,
using
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdLastRecord
How can I delete this record ?




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I show the record number in a merge database? Teego56 Mailmerge 2 November 7th 07 05:24 PM
Mailmerge: First Record in stead of Next Record Guus Mailmerge 6 February 6th 07 03:00 PM
Autonew macro in Word to select specific record from Excel database Peter Mailmerge 4 June 14th 06 05:39 PM
Mailmerge Next record John T Mailmerge 1 March 2nd 06 12:10 PM
Insert word OLE object from Access Database record. Ko Zaw Mailmerge 2 June 23rd 05 04:17 AM


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

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"