Inserting a macrobutton using AppleScript

N

norton.doug

I'd like to insert a macrobutton field into a word document using only
AppleScript... no VBA. Is it possible?

Thanks
-doug
 
J

JE McGimpsey

I'd like to insert a macrobutton field into a word document using only
AppleScript... no VBA. Is it possible?

One way (though I'm no expert - there may be much better ways):

set field_code to " MACROBUTTON MacroName \"display text\" "
tell application "Microsoft Word"
set myRange to collapse range text object ¬
of selection direction collapse start
set content of myRange to field_code
set myRange to move end of range myRange ¬
by a character item count (length of field_code)
set myField to make new field at myRange ¬
with properties {field code:myRange}
set content of myRange to ""
end tell
 

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