473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

The requested member of the collection does not exist ?

Expand|Select|Wrap|Line Numbers
  1.  
  2. object oMissing = System.Reflection.Missing.Value;
  3.                 object ofileName = "E:\\Template.dotx";
  4.                 Word.ApplicationClass myWordApp = new Microsoft.Office.Interop.Word.ApplicationClass();
  5.                 Word.Document myWordDoc = myWordApp.Documents.Add(ref ofileName, ref oMissing, ref oMissing, ref oMissing);
  6.                 myWordApp.Visible = true;
  7.                 myWordApp.Activate();                                                                  // start Word
  8.                 Word.Paragraph oPara1;
  9.                 oPara1 = myWordDoc.Content.Paragraphs.Add(ref oMissing);
  10.                 oPara1.Range.Text = "Heading 1";
  11.                 oPara1.Range.Font.Bold = 1;
  12.                 oPara1.Format.SpaceAfter = 24;    //24 pt spacing after paragraph.
  13.                 oPara1.Range.InsertParagraphAfter();
  14.                 //object oEndOfDoc = null;
  15.                 Word.Table oTable;
  16.                 //myWordDoc.Range wrdRa = myWordDoc.Bookmarks.get_Item(ref ofileName).Range;
  17.  
  18.                 Word.Range wrdRng = myWordDoc.Bookmarks.get_Item(ref ofileName).Range;
  19.  
  20.  
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
Mar 3 '11 #1
1 4442
GaryTexmo
1,501 Expert 1GB
I've never worked with this before, but if I had to speculate I'd imagine there is no bookmark named after the file name? Why are you using the filename like that anyway?
Mar 3 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: francescomoi | last post by:
Hi. I wonder wether this function exists or not: insertstr($string1, $string2, $position) This function inserts 'string1' into 'string2' at 'position'. If it exists, ok. If not, I'll write it...
20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
3
by: Ari Royce Hidayat | last post by:
Dear ALL, Is there some one ever faces this problem? And fix it? The scenario is: There's an html page that hosts a .net object (using object tag), and this page opens the second html page...
7
by: Nick J | last post by:
Hi, I keep getting this error message, Compile Error: Method or Data Member not found when trying to compile my access 2000 database ( I want to make an MDE file) although I do not receive this...
19
by: Born | last post by:
Here are my challenges to you: 1) Suppose object A has to do cleanup before it dies. Also suppose there are multiple references to A. How can I determine when and who to call Dispose (if you use...
6
by: subramanian100in | last post by:
why can't a static member function be declared as const ? We can declare a non-static member function as const, to indicate that it does not modify the non-mutable data members. In the same way, is...
2
by: =?Utf-8?B?UGF1bCBMaW52aWxsZQ==?= | last post by:
I have a solution that has both c# and vb.net projects. Visual Studio 2005 sp1. One of the lower level asseblies "Utils.csproj" is a c# project that references a 3rd party dll "Framework.dll"....
8
by: Tanzen | last post by:
I'm working in visual studio 2005 trying to learn visual basic. Having come from an VB for Access background, I'm finding it a big learning curve. I have been working through several e-books which...
158
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is...
1
by: sumitad | last post by:
i have decompiled an exe to source code, while opening the same now in VB 6.0 the following message appears The MSDN collection does not exist.Please reinstall MSDN. Somebody please help.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.