TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
eliza sahoo
NA
41
0
Working with mail merge word document using VB.NET
Mar 23 2010 8:56 AM
This tip demonstrates how to attach the DB source and populate fields from table to a mail merged word document in VB.NET.
Code Snippet
Dim objWord As New Object
objWord = CreateObject("Word.Application")
' Creating a word application
Dim objDoc As New Object
objDoc = CreateObject("Word.Document")
' Creating a word document object
objWord.application.WindowState = 0
' set the word window in normal state (Const
wdWindowStateNormal = 0)
objDoc = objWord.Documents.Add(DocsFolder.FullName & "\YOUR WORD DOC NAME")
' Add the mail merged document file
Dim NameBefore
WordMerg
e As String = objWord.ActiveDocument.Name
objWord.ActiveDocument.MailMerge.OpenDataSource("YOUR DATABASE PATH", _
Connection:="dsn=DSN NAME; dbq=" & YOUR DATABASE PATH & ";", _
sqlstatement:="select * from `" & tableName & "`")
Reply
Answers (
0
)
How to set interactive to main application window while has embed one on it
Calling C++ dll by using C# wrapper method , Exception occures