Results 1 to 2 of 2
2016-03-02, 12:46 #1
- 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).
2016-03-02, 17:20 #2
- Join Date
- Jan 2001
- Melbourne, Victoria, Australia
- Thanked 259 Times in 239 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