Solved

Using merge option of word document from

Posted on 2004-08-03
3
155 Views
Last Modified: 2010-04-23
Hi,
I have a word document template (let's say in C drive).
The document has few merge fields let's say <<FirstName>> and <<LastName>>.
Now, I need to create a dll/vb.net code where in when I run the application must replace the fields <<FirstName>> and <<LastName>> with the values passed and ask me to open/Close/save the document.
I am looking at similar feature to merge, replace text.
However, my original template must still be the same.

Regards,
0
Comment
Question by:kkuchana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
gova earned 125 total points
ID: 11724734
As an alternative you can try this code which uses the bookmarks
On a button click event write this code.

 Dim word_server As Word.Application
        Dim thisDoc As Word.Document
        word_server = New Word.Application()

        word_server.Documents.Open("C:\Original.doc")
        thisDoc = word_server.ActiveDocument
        word_server.Selection.GoTo( _
       What:=Word.WdGoToItem.wdGoToBookmark, _
       Name:="Name")
        word_server.Selection.TypeText( _
            Text:="some value")
        word_server.Visible = True
0
 

Author Comment

by:kkuchana
ID: 11724756
How about importing the namespaces
and hopefully Name:="Name" where the later "Name" is the BookMark
How about saving the document?

0
 
LVL 5

Expert Comment

by:gova
ID: 11724772
Imports Microsoft.Office.Interop
Imports Word

Name is the bookmark only
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question