Addressing a page in Microsoft Word
Addressing a page in Microsoft Word
- Subject: Addressing a page in Microsoft Word
- From: Christian Boyce via AppleScript-Users <email@hidden>
- Date: Wed, 3 Feb 2021 10:14:34 -0800
Is there a way to address a page in Microsoft Word? I can address a section,
but a section may contain many pages.
tell application "Microsoft Word"
set thePages to every page of document 1
repeat with aPage in thePages
set theParagraphs to every paragraph of aPage
-- do stuff here
end repeat
end tell
… but of course this doesn’t work because “every page of document 1” is not
understood.
What I’m really trying to do is examine each paragraph in a Word document but
if I do something like
tell application "Microsoft Word"
set theParagraphs to every paragraph of document 1
end tell
… It works fine for smallish documents but if I do that with a 100 page Word
document Word will crash. So, I’m trying to go page by page.
I could do so many good things if I could address a page in a Word document.
One thing I want to do is get the first paragraph of each page of a Word
document but I can’t get started since “page” doesn’t seem to exist as an
AppleScript-addressable entity in Word.
I know I can address “sections” and if there are enough sections it will solve
the crashing problem, but for my purposes it would be more useful to address
each page.
Apple’s Pages, and Text Edit, have no problem grabbing every paragraph of a 100
page document, but I am forced to use Word so I have to make it work there.
I’m somewhat new to scripting Word so I’m hoping that someone can point me in
the right direction. This is Word 16.45, the current “Microsoft 365” version.
THANK YOU—
c
_______________________________________________
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