Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2005

Tip: Looking for answers? Try searching our database.

No toolbars, status bar, menu after mailmerge in word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tanguy - 03 Aug 2005 13:40 GMT
Hi,

I developed a mail merge program in C# but when I execute the merging (to a
new document), Word appears without any toolbar, menu or statusbar, but
mailmerge worked fine

What happened?

Here is my code:

public void ExecuteMailMerge(string contactids, System.Windows.Forms.Label
displayInfo)
{
              wordApp.Application word = null;

    object missing = System.Reflection.Missing.Value;
    object oTrue = true;
    object oFalse = false;

    try
    {
    //Create Word Application
        word = new wordApp.ApplicationClass();
        object wordTemplateName = templateFileName;                       
        //Open Word template
        wordApp.Document doc = word.Documents.Open(ref wordTemplateName,ref
missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref
missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref
missing,ref missing,ref missing);

        wordApp.MailMerge wrdMailMerge = doc.MailMerge;

        //Create DataSource
        CreateMailMergeDataFile(word,doc,contactids);
       
                               wrdMailMerge.Destination =
wordApp.WdMailMergeDestination.wdSendToNewDocument;
               
        wrdMailMerge.Execute(ref oFalse);
        word.Visible = true;

        //Close Word Template
        doc.Saved = true;
        doc.Close(ref oFalse,ref missing,ref missing);

        //Flush ressources
        wrdMailMerge = null;
        doc = null;
       
                               //Delete DataSource
        System.IO.File.Delete("C:\\datasource.xml");
    }
    catch(Exception erreur)
    {
                   word.Quit(ref oFalse,ref oFalse,ref oFalse);
        throw new Exception(erreur.Message);
    }
}

Thx
tanguy - 04 Aug 2005 10:43 GMT
Ok, I found what happened but not how to avoid it.

In fact, during mailMerge.execute action, the program found one mergeField
which does not fit with my datasource, so I got a messagebox asking me what
to do. I answer to delete this field... And it opened the document without
any commandBar.

If I suppress this field in the template or add a corresponding value in the
data source, it works fine and I have all command bars.

Is there a way to define a property which ignores unfittable mergefield?

"tanguy" a écrit :

> Hi,
>
[quoted text clipped - 56 lines]
>
> Thx
Peter Jamieson - 04 Aug 2005 17:07 GMT
> Is there a way to define a property which ignores unfittable mergefield?

No, you have to do what you have already done...

<<If I suppress this field in the template or add a corresponding value in
the
data source, it works fine and I have all command bars.>>

Peter Jamieson

> Ok, I found what happened but not how to avoid it.
>
[quoted text clipped - 74 lines]
>>
>> Thx

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.