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  

MailMergeDataSource iteration extremly slow



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 4th, 2010, 11:40 AM posted to microsoft.public.word.mailmerge.fields
AMR
external usenet poster
 
Posts: 20
Default MailMergeDataSource iteration extremly slow

Hi

I'am reading addresses from a MailMergeDataSource in Word 2007.
My problem is, that this is extremly slow. Every invoke from get_Item will
take a sec.
The app is a C# Word 2007 Application Add-In.

Is there some solution to speed it up or an another approach to solve the
issue?

Code:

object indexLastname = MailMergeDataFieldIndices.Lastname;
object indexFirstname = MailMergeDataFieldIndices.Firstname;
object indexCompany = MailMergeDataFieldIndices.Company;
object indexStreet = MailMergeDataFieldIndices.Street;
object indexZip = MailMergeDataFieldIndices.Zip;
object indexCity = MailMergeDataFieldIndices.City;

object index = MailMergeDataFieldIndices.None;
for (int i = 0; i count; i++) {
string name = fields.get_Item(ref indexFirstname).Value + " " +
fields.get_Item(ref indexLastname).Value;
string company =fields.get_Item(ref indexCompany).Value;
string street =fields.get_Item(ref indexStreet).Value;
string zip = fields.get_Item(ref indexZip).Value;
string city = fields.get_Item(ref indexCity).Value;

dataSrc.ActiveRecord =
Word.WdMailMergeActiveRecord.wdNextDataSourceRecor d;
}

Thanks in advance
amr

 




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 02:44 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.