varun kumar

varun kumar

  • NA
  • 4
  • 0

The requested member of the collection does not exist ?

Mar 3 2011 2:39 AM
                object oMissing = System.Reflection.Missing.Value;
                object ofileName = "E:\\Template.dotx";
                Word.ApplicationClass myWordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
                Word.Document myWordDoc = myWordApp.Documents.Add(ref ofileName, ref oMissing, ref oMissing, ref oMissing);
                myWordApp.Visible = true;
                myWordApp.Activate();                                                                  // start Word
                Word.Paragraph oPara1;
                oPara1 = myWordDoc.Content.Paragraphs.Add(ref oMissing);
                oPara1.Range.Text = "Heading 1";
                oPara1.Range.Font.Bold = 1;
                oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.
                oPara1.Range.InsertParagraphAfter();
                Word.Table oTable;
                object objr = myWordApp.Selection;
                Word.Range wrdRng = myWordDoc.Bookmarks.get_Item(ref ofileName).Range;


Actually i'm using word template file to create the new word file here.

It shows the error when the cursor come to last line.

I dont know how to solve this problem.

Please give me the solution to this problem

Thanks to all.

Answers (1)