View Single Post
  #25   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Use DocVariable field to initiative numbering?

Hi Tom,

Do you recommend just using the help file in the Visual Basic
Editor, or using some other tutorial book?


IMO the best way to approach learning is quite personal - but
a. something to bear in mind is that VBA is in theory on its way out, to be
superseded by VB.NET or some usuch on Windows and (in effect) Applescript on
Mac. It's still there in Office 2007, but there are an increasing number of
things you can't do without resorting to .NET. That said, for the kind of
things you're doing at the moment that's probably a bit of a red herring.
b. there /is/ a lot of info in the Help files accessible via VBE, about
both VBA and the VBA as it applies to the Word object model. Word Help also
contains a lot of info. Also, I refer to the View|Object Browser function in
VBE a lot - understanding how Word's object model really works is critical.
c. Personally, I tend to learn by experiment, but usually find it's useful
to start with an overview of a programming language. I can't recommend one,
but I expect you'll find some pointers in VBA-oriented groups here. As fr as
I know, there are no good books specifically about Word VBA or the Word
object model in English (you can search www.amazon.de for the ones in German
by CIndy Meister, myself, and others if you happen to read German:-)).
d. the Word MVPs site at http://word.mvps.org has plenty of useful examples
(and the more general http://www.mvps.org site can also be useful). There
are several programming-oriented groups similar to this one where you're
more likely to get good general-purpose VBA help (and you can search all
these groups using Google groups).
e. A few things I'd say about VBA and object models which it took me a long
time to learn:
- you won't usually find documentation in the object model about the
sequence of objects in collections. In some cases they do appear to be in
the "intuitively obvious" sequence and in some cases you may as well rely on
that sequence even though it isn't documented. I found this the single most
irritating barrier to using VBA when it first appeared.
- some objects in the Word object model correspond to objects that persist
in the Word document (for example, Document variables) but others are not
persisted and are only available while your code is running (e.g. Range
objects). It should be reasonably obvious which is which, but at first it's
easy to get it wrong.
- you will probably end up using Range objects a lot. IMO it is one of the
worst-designed objects in Word. It's far more awkward to use than it needs
to be, and is far too sensitive to the current view, coping particularly
badly with fields. But since you can't really avoid it, it's probably worth
spending quite a lot of time learning to use that one object.

Peter Jamieson
-
"Tom" wrote in message
ups.com...
Thanks Peter. Yes, I know, I need to start figuring out macros for
myself. Do you recommend just using the help file in the Visual Basic
Editor, or using some other tutorial book? I didn't realize how
powerful macros were until this past week. I really appreciate your
responses to my questions. I have learned quite a bit from this forum.