Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i was try below code for Embedding a Document in word but i get error message like==
"The requested member of the collection does not exist." my word file not blank any idea why i am getting this error any idea what i am done wrong please help me to solve the issue




C#
//ICON LABEL CAN BE THE NAME OF THE FILE,

           //ITS THE NAME DISPLAYED BESIDES THE EMBEDDED DOCUMENT

           Object oIconLabel = "File Name";



           //INCASE WE NEED THE EMBEDDED DOCUMENT TO BE DISPLAYED AS A SPECIFIC ICON,

           //WE NEED TO SPECIFY THE LOCATION OF THE ICON FILE

           //ELSE SET IT TO oMissing VALUE

           Object oIconFileName = "C:\\IconFile.ico";


           //THE BOOKMARK WHERE THE FILE NEEDS TO BE EMBEDDED

           Object oBookMark = "My_Custom_BookMark";

           //THE LOCATION OF THE FILE

           Object oFileDesignInfo = "C:\\1.doc";






           //METHOD TO EMBED THE DOCUMENT

           oWordDoc.Bookmarks.get_Item(ref oBookMark).Range.InlineShapes.AddOLEObject(ref oClassType, ref oFileDesignInfo, ref oFalse, ref oTrue, ref oIconFileName,

               ref oMissing, ref oIconLabel, ref oMissing);
Posted
Updated 28-Oct-13 21:58pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900