Jeffery B Paarsa said:
Totally, Yes I am rookie on that aspect. Actually I am waiting for the
shipment of my Visual studio dot net and currently I am using the
downloaded
version of Visual Basic Express. So on that part I may be missing a lot.
I
thought I could play around with the Express version while waiting for my
shipment of my software and shipment of my books. So tell me please does
downloaded version of Visual Basic Express compatible with VBA or dot net?
OK, we need to be clear on this matter of "compatible".
VB6 and VBA are pretty nearly the same language - they have the same syntax
and depend in part on the same runtimes. VB6 can be used to make compiled
executables, while VBA is embedded within Office applications, and VBA code
is included within Office documents.
VB6 and VB.NET are two different languages. Microsoft still likes to claim
that the latter is a newer version of the former, but that claim is baloney.
If you want to read up about some of the history of this, take a look at
www.classicvb.org
The languages *are* similar, sufficiently so that if you forget which one
you are in, you can get confused by the differences in behavior. The
differences can be obvious, such as a Long being a 32-bit signed integer in
VB6/VBA and a 64-bit signed integer in VB.NET. Others can be more subtle,
such as the way object destruction is handled. Therefore, you can say that
VB6/VBA and VB.NET are not very compatible. Certainly Microsoft has never
managed to create a converter that could reliably convert anything more than
a "Hello World" application from one to the other.
But that, while it is the question you asked, I suspect it isn't quite what
you meant to ask. What you meant was "Is VB.NET compatible with the Word
object model?" And the answer to that is "yes". You can create a
Word.Application object and then use all the objects within the Word object
model fro VB.NET. The *way* in which you use them will have to be subtly
different from time to time. The Word object model is documented in the Word
VBA help files, and so all the code examples and definitions assume the use
of VBA. For instance, if a particular property is shown in the Help file as
being of type Long, you will have to remember that for you in VB.NET it is
actually an Integer.
One further thing. In the Word VBA editor, if you go to Tools References,
you will find that references to a couple of external libraries have been
set. If you open up the VBA editor in Excel, you will find that different
libraries have been checked. This gives you immediate access to the Excel
object model rather than the Word object model - all within the same
language. The VB.NET equivalent of this is importing Namespaces. For the
Word or Excel object models, this has to be done explicitly. I'll leave it
to you to look up in the VB.NET help how to import a namespace. If you
choose not to import the namespace, then this is another thing you need to
be aware of when trying to convert VBA code examples from the newsgroup or
the 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