?
Solved

Using merge option of word document from

Posted on 2004-08-03
3
Medium Priority
?
156 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 250 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

752 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