Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2016
    Thanked 0 Times in 0 Posts

    Word VBA Macro to set a variable using AppleScript

    How would you use a Word VBA Macro to set a variable using AppleScript?

    Needed so that this variable can be used externally to Word VBA by another program
    (which can read Applescript Variables but not native Word VBA variables).


  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Melbourne, Victoria, Australia
    Thanked 295 Times in 267 Posts
    In general, variables are temporary placeholders that exist for the life of the script running it and then disappear afterwards. This means you can't create one and leave it sitting around for a different application to make use of.

    What you CAN do is save something hidden in a document and then write your script so that it reads that information as its 'variable'.
    Word has document properties which are useful for this purpose but it also has document variables which can only been seen by macros. To set a document variable you can do something like this
    ActiveDocument.Variables("greeting").Value = "hello mum"
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts