Sending fields Word from VB.NET

N

Neal

How do I sent information to word from a program in
Visual Basic (2003)? For example, when calling word with
the Shell command. In particallar I would like to pass
an array to Word to be use to fillin information in a
template.

Neal
 
C

Cindy Meister -WordMVP-

Hi Neal,
How do I sent information to word from a program in
Visual Basic (2003)? For example, when calling word with
the Shell command. In particallar I would like to pass
an array to Word to be use to fillin information in a
template.
any particular reason you want to use Shell instead of
GetObject or CreateObject? The latter are usually better
when you're trying to automate.

Then, we need to know more details about the target in this
template in order to give you any sample code.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
N

Neal

I want to call Word from a VB.NET progran, and send
auguments such as an array or to start word using a
tempplate.
 
C

Cindy Meister -WordMVP-

Hi Neal,
I want to call Word from a VB.NET progran, and send
auguments such as an array or to start word using a
tempplate.
I recommend asking this in one of the dotnet newsgroups, or
possibly in the vsnet.vstools.office newsgroup. I'm too new
to VB.NET, myself, to be able to help you very much.

Generally, NET works the same way as, say VB did. You can
use the New keyword or CreateObject to start the Word
application and assign it to an object variable. You then
use the usual Automation commmands to do what you need to
have done.

Just to give you an idea, it would go something like this
(but the qualifier namespaces I'm certain are NOT correct
unless you've done an Imports). You'd also need to set a
Reference to the Word object library for your project.

Dim appWord as Word.Application
appWord = New Word.Application
Dim doc as Word.Document =
appWord.Documents.Add(TemplatePath)
doc.Range.Text = "Hello World!"

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top