I have created a 2007 addin using VSTO for office 2007 second edition, which will add a custom pane and will retrieve the data from the sql server. Now i have to add this data to the word document in a particular location. I have tried using Bookmarks. But the value is appending in the bookmark. I want to raplace the content in bookmark. How to do it??? Thanks in advance.
Hi Rams At the simplest level, you need something like this: ActiveDocument.Bookmarks("MyBookmark").Range.Text = "My new text" However, that will destroy the bookmark. If you need to retain the bookmark, see Inserting text at a bookmark without deleting the bookmark http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm Hope this helps. Shauna Kelly. Microsoft MVP. http://www.shaunakelly.com/word "Rams" wrote in message news:E53E686F-21D3-4AFB-80D7-67486D9F5095@microsoft.com... > > I have created a 2007 addin using VSTO for office 2007 second edition, > which > will add a custom pane and will retrieve the data from the sql server. > > Now i have to add this data to the word document in a particular location. > I > have tried using Bookmarks. But the value is appending in the bookmark. I > want to raplace the content in bookmark. How to do it??? > > Thanks in advance.
Thanks. It works fine. I have a table of 10 rows. In each row i have the bookmark. Is there any other way for filling up the tables ??? "Shauna Kelly" wrote: > Hi Rams > > At the simplest level, you need something like this: > > ActiveDocument.Bookmarks("MyBookmark").Range.Text = "My new text" > > However, that will destroy the bookmark. If you need to retain the bookmark, > see > Inserting text at a bookmark without deleting the bookmark > http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm > > Hope this helps. > > Shauna Kelly. Microsoft MVP. > http://www.shaunakelly.com/word > > > "Rams" wrote in message > news:E53E686F-21D3-4AFB-80D7-67486D9F5095@microsoft.com... > > > > I have created a 2007 addin using VSTO for office 2007 second edition, > > which > > will add a custom pane and will retrieve the data from the sql server. > > > > Now i have to add this data to the word document in a particular location. > > I > > have tried using Bookmarks. But the value is appending in the bookmark. I > > want to raplace the content in bookmark. How to do it??? > > > > Thanks in advance. > > >
Hi Yes, there are lots of ways for filling in tables. Can you give us some more information about the nature of the data and what you're trying to achieve? Hope this helps. Shauna Kelly. Microsoft MVP. http://www.shaunakelly.com/word "Rams" wrote in message news:2F149DF4-54B1-4B0E-A51C-0F37588E47EF@microsoft.com... > > Thanks. It works fine. > > I have a table of 10 rows. In each row i have the bookmark. Is there any > other way for filling up the tables ??? > > > "Shauna Kelly" wrote: > >> Hi Rams >> >> At the simplest level, you need something like this: >> >> ActiveDocument.Bookmarks("MyBookmark").Range.Text = "My new text" >> >> However, that will destroy the bookmark. If you need to retain the >> bookmark, >> see >> Inserting text at a bookmark without deleting the bookmark >> http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm >> >> Hope this helps. >> >> Shauna Kelly. Microsoft MVP. >> http://www.shaunakelly.com/word >> >> >> "Rams" wrote in message >> news:E53E686F-21D3-4AFB-80D7-67486D9F5095@microsoft.com... >> > >> > I have created a 2007 addin using VSTO for office 2007 second edition, >> > which >> > will add a custom pane and will retrieve the data from the sql server. >> > >> > Now i have to add this data to the word document in a particular >> > location. >> > I >> > have tried using Bookmarks. But the value is appending in the bookmark. >> > I >> > want to raplace the content in bookmark. How to do it??? >> > >> > Thanks in advance. >> >> >>