Reply
 
Thread Tools Display Modes
  #1   Report Post  
tanguy
 
Posts: n/a
Default No toolbars, status bar, menu after mailmerge in word 2003

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
  #2   Report Post  
tanguy
 
Posts: n/a
Default

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,

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

  #3   Report Post  
Peter Jamieson
 
Posts: n/a
Default

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

"tanguy" wrote in message
...
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,

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



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
Missing Menu and toolbars in Word jilldean Microsoft Word Help 1 June 9th 05 07:10 PM
Missing Menu Bar and Toolbars lorcan Microsoft Word Help 1 January 13th 05 10:33 PM
Missing Menu Bar and Toolbars lorcan o toole Microsoft Word Help 0 January 13th 05 10:31 PM
lost toolbars and menu options Michele Microsoft Word Help 1 January 4th 05 06:37 PM
Be able to put toolbars on same row as menu bar in Word. wockets Microsoft Word Help 1 December 12th 04 12:23 AM


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