J
JW
I pasted an example C# mail merge code from microsoft
website(http://support.microsoft.com/?kbid=301659)
concerning Mail Merge and placed on a form as the
direction requested. I also referenced the COM form
Microsoft Word Object Library. When I build this project
I get the following error:
C:\NET Projects\Mail Merge\MailMerge\Form1.cs(108):
Cannot apply indexing with [] to an expression of
type 'Word.Tables'
The error occurs at the following code:
private void FillRow(Word._Document oDoc,
int Row, string Text1,
string Text2, string Text3,
string Text4)
{
// Insert the data into the
specific cell.
oDoc.Tables[1].Cell
(Row,1).Range.InsertAfter(Text1);
oDoc.Tables[1].Cell
(Row,2).Range.InsertAfter(Text2);
oDoc.Tables[1].Cell
(Row,3).Range.InsertAfter(Text3);
oDoc.Tables[1].Cell
(Row,4).Range.InsertAfter(Text4);
}
Am I forgetting to reference something else. Please
help. Fustrated C# programmer.
website(http://support.microsoft.com/?kbid=301659)
concerning Mail Merge and placed on a form as the
direction requested. I also referenced the COM form
Microsoft Word Object Library. When I build this project
I get the following error:
C:\NET Projects\Mail Merge\MailMerge\Form1.cs(108):
Cannot apply indexing with [] to an expression of
type 'Word.Tables'
The error occurs at the following code:
private void FillRow(Word._Document oDoc,
int Row, string Text1,
string Text2, string Text3,
string Text4)
{
// Insert the data into the
specific cell.
oDoc.Tables[1].Cell
(Row,1).Range.InsertAfter(Text1);
oDoc.Tables[1].Cell
(Row,2).Range.InsertAfter(Text2);
oDoc.Tables[1].Cell
(Row,3).Range.InsertAfter(Text3);
oDoc.Tables[1].Cell
(Row,4).Range.InsertAfter(Text4);
}
Am I forgetting to reference something else. Please
help. Fustrated C# programmer.