Word and AppleScript

S

Sol Apache

Below is a note I sent to the microsoft.public.mac.office newsgroup arising
from my late discovery that VBA will not be available for Word 2008.

Hopefully Matt Newburg will be around to help us with AppleScript in Word
2008 (will you Matt?).

In the meantime does anyone know:

1. If AppleScript scripts in Word 2008 can be embedded in templates as VBA
macros can, and be placed in buttons and toolbars.

2. The VBA macro for adding AppleScript editor to the Tools/Macros menu in
Word 2004 - if so, can this please be posted. Cannot find anything in VB
Help for opening external applications, though JE McG has said it is
possible.

Have tried (amongst other methods): ThePath$ = MacScript
(³/Applications/AppleScript/Script Editor.app²) but none work.

Many thanks

Sol

_____________________________________________________________

Re: (Microsoft.public.mac.)Applescript newsgroup?

Hi Daiya

This is in anticipation of Word 2008. VBA won¹t be in it, and Microsoft
plans to have more AppleScript functions to replace it.

Hopefully AppleScript will be able to function in the same way as VBA did -
macros embedded in templates, able to be in buttons and toolbars, etc. Not
sure if it will work with recording as VBA did. You can record in
AppleScript but not as well as with macros in Word.

Once Word 2008 is out, there will be a need for Word AppleScript experts!
 
J

JE McGimpsey

Sol Apache said:
1. If AppleScript scripts in Word 2008 can be embedded in templates as VBA
macros can, and be placed in buttons and toolbars.

I'd think that these would be very unlikely.
2. The VBA macro for adding AppleScript editor to the Tools/Macros menu in
Word 2004 - if so, can this please be posted. Cannot find anything in VB
Help for opening external applications, though JE McG has said it is
possible.

I must have misunderstood what you were asking - you can't add the
Applescript *editor* to an Office menu. You can, however, add a menu
item that calls the scripts using VBA. I've posted an outline of how to
do it in the other group.
 
J

JE McGimpsey

2. The VBA macro for adding AppleScript editor to the Tools/Macros menu in
Word 2004 - if so, can this please be posted. Cannot find anything in VB
Help for opening external applications, though JE McG has said it is
possible.

I must have misunderstood what you were asking - you can't add the
Applescript *editor* to an Office menu. You can, however, add a menu
item that calls the scripts using VBA. I've posted an outline of how to
do it in the other group.[/QUOTE]

After posting this, I realized that I was assuming that you wanted to
run the AS editor *within* the Word environment, which you can't.

However, if you add the Applescript item to the menu, as in my other
post, you can certainly attach it to a macro that opens the editor. One
simple way:

Public Sub CallASEditor
MacScript ("tell application ""Script Editor""" & vbCr & _
"activate" & vbCr & "end tell")
End Sub

In fact, I've just added that to my startup add-in.
 
P

Paul Berkowitz

Please see my reply to your " Re: Office 2008 for Mac and AppleScript" post
in the .mac.office newsgroup.

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
S

Sol Apache

Thank you very much for your replies on both of these lists.

This is the VBA code I wanted, but I am glad you misunderstood me because
you have given me more code which will be useful.



Sol


I must have misunderstood what you were asking - you can't add the
Applescript *editor* to an Office menu. You can, however, add a menu
item that calls the scripts using VBA. I've posted an outline of how to
do it in the other group.

After posting this, I realized that I was assuming that you wanted to
run the AS editor *within* the Word environment, which you can't.

However, if you add the Applescript item to the menu, as in my other
post, you can certainly attach it to a macro that opens the editor. One
simple way:

Public Sub CallASEditor
MacScript ("tell application ""Script Editor""" & vbCr & _
"activate" & vbCr & "end tell")
End Sub

In fact, I've just added that to my startup add-in.[/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top