Re: Can anyone explain Word behavior???
Re: Can anyone explain Word behavior???
- Subject: Re: Can anyone explain Word behavior???
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 13 Mar 2001 08:55:08 -0800
On 3/13/01 4:44 AM, "Xandra Lee" <email@hidden> wrote:
>
Paul Berkowitz
>
> What works perfectly is to learn how to do what you need in
>
> Visual Basic for Word, then use the command 'do Visual Basic "[the VB script
>
> here]" '. I'm sorry that this is not an easy answer, but it's the one that
>
> works.
>
>
I'll take your word on this, but some follow up questions:
>
>
1. How does one learn VB Script. I've never found any documentation
>
except books on the topic intended for Windoze users. (I've not purchased
>
on the assumption that I couldn't count on the same implementation on Mac.
>
>
VBA for Word is 99.8% the same as on Windows: it's mostly just file paths
that have to be changed to the Mac version with colons. You can manage well
with the documentation that comes in the VB Help in Word itself. To access
it: get out your Office 98 or 2001 CD and find the Value Pack installer. Do
a custom install for Programmability. Then go into Tools --> Macro -->Visual
Basic Editor. When it comes up, go to Help --> Contents and Index. The link
to Visual Basic How-To topics gets you to explanations of how the Editor
works. (It's a rather amazing dynamic editor, probably comparable to SD2 and
Scripter). Visual Basic Conceptual Topics and VB Language Reference are the
equivalent of the ASLG online. Scroll to the bottom and you get all the VB
app Help including VBA for Word. Go there and browse among the Objects,
Methods and Properties. It's like an entire Word Dictionary cum Language
Guide, interlinked and with examples, about the size of the ASLG, just for
Word. It contains all necessary Mac-special references. (There are certain
commands that won't work on the Mac, mostly ActiveX stuff - it tells you -
and a few commands that work only on the Mac. Back in the main VB language
Reference read up on the MacScript method -it's the way you call AppleScript
within VB the same way you call VB within AppleScript - very nifty. You can
put an entire AppleScript in quotes or in a variable, or call an applet by
its file path, just as in AppleScript you can put a whole VB script in
quotes or else call an installed macro. In both cases you have to remember
to convert line endings, but it means the two languages can talk back and
forth to each other.)
So that also means that you can get the books that explain VB and it will
mostly all apply to the Mac version too. There are lots of official manuals
published by MS (check amazon.com). Just yesterday I got two O'Reilly books:
"VB and VBA in a Nutshell" and "Writing Word Macros", virtually all of which
is useable on the Mac, especially the second book.
And there are great newsgroup (rather than mailing list) resources via the
Microsoft News Server at msnews.microsoft.com, particularly
microsoft.public.word.macword2001, microsoft.public.word.macword98,
microsoft.public.word.vba.general
and lots of more specialized word VBA newsgroups.
>
2. Does VB use variables/list forms like AppleScript?
>
>
Variables - yes. Although you can you use them mostly just as you do in
AppleScript, they actually come in various data types, and it's better to
specify the type when you define them. Lists - no. They have instead arrays
- which I'm just beginning to learn about: that's why I bought the VBA in a
Nutshell book. (You seem to be able to get quite far in Word without knowing
anything about them.) The way you use a lot of the Methods and Properties
employ parameters that function almost exactly like records in AppleScript,
although they're not called that.
--
Paul Berkowitz