need to use PIA? VB6?

K

Kevin

I want to write an application with VB.Net that uses Office automation
to manipulate Word files and templates from Word 97 to the latest
version of Word.

I don't understand whether I can/must use PIAs, whether they're
appropriate only for writng an application for a single version of
Word, or whether if I want to target many Word versions I would be
better off using VB6. I can't expect that all users have .Net installed.

Can someone please shed some light on this subject? Thank you.

Kevin
 
J

Jonathan West

Kevin said:
I want to write an application with VB.Net that uses Office automation
to manipulate Word files and templates from Word 97 to the latest
version of Word.

I don't understand whether I can/must use PIAs, whether they're
appropriate only for writng an application for a single version of
Word, or whether if I want to target many Word versions I would be
better off using VB6. I can't expect that all users have .Net installed.

Can someone please shed some light on this subject? Thank you.


If you can't assume that people will have the .NET framework installed, then
you will have to install the framework along with your application, or not
use any of the .NET products.

AFAIK there are only PIAs for Office 2003. If you want to control older
versions of Office then you will need to do so using COM, probably using
late binding, so you can bind to whichever version of Office happens to be
installed on each individual user's PC.

Office 2000 and later includes the VB6 runtime components, so if you use VB6
you can guarantee that you will not need to install the runtimes. Office 97
and later includes the VB5 runtimes.

In my experience, relatively few people are still using Office 97, so you
might consider making Office 2000 your minimum supported version.

If you want to target multiple versions of Word, then I would recommend that
you install the oldest supported version on your development machine, and
then test on other machines with later versions.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
K

Kevin

Jonathan said:
If you can't assume that people will have the .NET framework
installed, then you will have to install the framework along with
your application, or not use any of the .NET products.

AFAIK there are only PIAs for Office 2003. If you want to control
older versions of Office then you will need to do so using COM,
probably using late binding, so you can bind to whichever version of
Office happens to be installed on each individual user's PC.

Office 2000 and later includes the VB6 runtime components, so if you
use VB6 you can guarantee that you will not need to install the
runtimes. Office 97 and later includes the VB5 runtimes.

In my experience, relatively few people are still using Office 97, so
you might consider making Office 2000 your minimum supported version.

If you want to target multiple versions of Word, then I would
recommend that you install the oldest supported version on your
development machine, and then test on other machines with later
versions.

Thank you. If I...
1. Make Office 2000 my minimum supported version, as you suggest, and

2. Use VB.Net, not VB6

Would I need to detect the Word version, and use COM with older
versions and a .Net with 2003, or could I use COM with all versions
after Word 97?

I'm looking at Calling COM Components from .NET Clients in the KB,

http//msdn.microsoft.com/vbasic/previous/2003/using/interop/default.aspx
?pull=/library/en-us/dndotnet/html/callcomcomp.asp

Assuming that I'm starting fresh, though, and don't already have COM
code built, can you suggest how I start, or point me to a reference.
I've got the O'Reilly Nutshell books for VB.Net and VB/VBA, but I'm
going to need an article/book on Word automation to get me started.

Thanks.

Kevin
 
J

Jonathan West

Kevin said:
Thank you. If I...
1. Make Office 2000 my minimum supported version, as you suggest, and

2. Use VB.Net, not VB6

Would I need to detect the Word version, and use COM with older
versions and a .Net with 2003, or could I use COM with all versions
after Word 97?

I'm sure you could use COM with all versions. Because there are feature
differences and object model differences between the different versions of
Word, you may need to detect the Word version anyway. The
Application.Version property will give you this.
I'm looking at Calling COM Components from .NET Clients in the KB,

http//msdn.microsoft.com/vbasic/previous/2003/using/interop/default.aspx
?pull=/library/en-us/dndotnet/html/callcomcomp.asp

Assuming that I'm starting fresh, though, and don't already have COM
code built, can you suggest how I start, or point me to a reference.
I've got the O'Reilly Nutshell books for VB.Net and VB/VBA, but I'm
going to need an article/book on Word automation to get me started.

Start here.

Getting To Grips With VBA Basics In 15 Minutes
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm


Creating a macro with no programming experience using the recorder
http://www.word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm

In many cases, the macro recorder can be very useful even to an experienced
programmer. Record a macro while doing some task by hand. Open up the VBA
editing window and take a look at the objects used. Look them up in the VBA
Help, and then write the code properly in VBA, VB or VB.NET as appropriate.

There are lots of other articles on Word VBA at the MVP site.

But your primary resource should be the Word VBA Help file.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
K

Kevin

Jonathan said:
of >> > Word, or whether if I want to target many Word versions I
would be >> > better off using VB6. I can't expect that all users
have .Net >> > installed.
so >> you might consider making Office 2000 your minimum supported
version.

I'm sure you could use COM with all versions. Because there are
feature differences and object model differences between the
different versions of Word, you may need to detect the Word version
anyway. The Application.Version property will give you this.


Start here.

Getting To Grips With VBA Basics In 15 Minutes
http://www.word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm


Creating a macro with no programming experience using the recorder
http://www.word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm

In many cases, the macro recorder can be very useful even to an
experienced programmer. Record a macro while doing some task by hand.
Open up the VBA editing window and take a look at the objects used.
Look them up in the VBA Help, and then write the code properly in
VBA, VB or VB.NET as appropriate.

There are lots of other articles on Word VBA at the MVP site.

But your primary resource should be the Word VBA Help file.

Thanks. I've looked at these references. Do you have a suggestion as to
where I can look for examples of using VB.Net with COM? It's the
structure of establishing this that's puzzling me. Thanx. Kevin
 
J

Jonathan West

Kevin said:
Jonathan West wrote:

Thanks. I've looked at these references. Do you have a suggestion as to
where I can look for examples of using VB.Net with COM? It's the
structure of establishing this that's puzzling me. Thanx. Kevin

I don't use VB.NET, and this group is primarily about programming Word,
which tends to be mainly about the language that is supplied with Word i.e.
VBA.

These two articles are about using COM to control Word from another
application, or another application from Word, but the code examples are
both in VBA.

Control Word from Excel
http://www.word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

Early vs. Late Binding
http://www.word.mvps.org/FAQs/InterDev/EarlyvsLateBinding.htm

If you can't adapt this to VB.NET, then it might be an idea to repost this
question in one of the VB.NET groups, where I'm sure somebody will be able
to help.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
H

Howard Kaikow

Office 2002 also has a PIA, but there are significant differences.

For earlier versions, there's no PIA, so it is harder.

Better off using VB 6, as most systems already have the VB 6 run times
installed.
Not to mention, you can protect the code from prying eyes in VB 6, not in
VB.NOT.
 

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