Re: Fields in Word
Re: Fields in Word
- Subject: Re: Fields in Word
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 18 Feb 2008 12:37:34 -0800
- Thread-topic: Fields in Word
On 2/18/08 11:46 AM, "Stockly, Ed" <email@hidden> wrote:
>
>> Which version of Word? There have been three for Word in OS X: Word X, Word
> 2004, Word 2008.
>
> I'm running 2004, I'm she's running X or 2004, I doubt if it's 2008.
>
>
>>> If the student has Word X or 2004, he should be able to run the identical
>>> VBA
> macro as on Word Windows.
>
> {=({PAGE}+1}} is the macro. Is that VB? It generates a "syntaxError" on my
> mac, but apparently there's another step on Windows where a script is run
> just before printing that makes it work. I don't know what that is, maybe
> another VB macro?
{=({PAGE}+1}} is not a macro. It's a field. (The { } are not regular braces,
and can't be typed. You have to use View Field Codes in Preferences/View to
see those. According to what you said before, you can't enter the exact
configuration of these that you want manually in the UI but need need to do
it by VBA.
The "script" that runs just before printing is a VBA macro which specifies
how to insert the { PAGE } field in the desired manner into the appropriate
headers and footers. If you get hold of the document that has the macro
("script") and open it in Word 2004, then go to Tools/Macros/Macro, you'll
see its name there. Select it, click Edit, and it will open up in its Module
in the VB Editor. You can copy and paste the text into another document to
have it handy, but staying in VB Editor for a while and using its Help to
track down some of the terms used there would be, well, helpful.
All you really have to do is click Run and the macro should run and do
exactly what the student wants, without further ado. That's how you "run the
script". It may be that the student did a paste and copy of the document
rather than getting a real copy, and so doesn't have the macro, I suppose.
>> Instead of reinventing the wheel, he could just use the macro in X or 2004.
>
> Since I'm totally impatient, I'm going to try to do the same kind of thing
> on the mac side.
>
> I'll try appleScript, creating a text box where the footer is on each page
> and inserting a page number there.
Yes, you *ought* to be able to do it by AppleScript, but if you haven't
experienced Word AppleScript yet, you're going to have a big learning curve,
Hint: to get into the headers and footers, which are not elements of
'section' even though they "should" be and can't be found in the object
model but in a sort of limbo, check out 'get header' and 'get footer' with
the index parameter in the Text Suite, which may also not be the place you'd
think to look for them.
And text box needs a text frame, both in the Drawing Suite. Note that, by
some quirk, text frame has a 'text range' property, rather than a 'text
object' property like everything else in Word, of the class also
(unfortunately) called 'text range'. That sort of thing will keep you busy
for a while.
>
>
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden