vba - The MacScript function is not working well in Office for Mac 2016! Any ideas? -


my macros use macscript heavily, doesn't seem working in of latest office mac 2016 preview builds

the macscript command, used support inline apple scripts in office mac 2011, being deprecated. due restrictions of sandbox, macscript command can no longer invoke other applications such finder. therefore discourage use of command. cases require changing existing code doesn’t use macscript, can use applescripttask command (see below).

the new applescripttask command executes applescript script. similar macscript command except runs applescript file located outside sandboxed app. call applescripttask follows:

 dim myscriptresult string   myscriptresult = applescripttask ("myapplescriptfile.applescript", "myapplescripthandler", "my parameter string")  

where:

  • the “myapplescript.applescript” file must in ~/library/application scripts/[bundle id]/, extension applescript not mandatory, .scpt may used
  • “myapplescripthandler” name of script handler in myapplescript.applescript file
  • “my parameter string” single input parameter “myapplescripthandler” script handler.
  • the corresponding applescript excel in file named "myapplescriptfile.applescript" in ~/library/application scripts/com.microsoft.excel/

note: [bundle id]s mac word, excel , powerpoint are:

  • com.microsoft.word
  • com.microsoft.excel
  • com.microsoft.powerpoint

an example of handler follows:

on myapplescripthandler(paramstring)       #do paramstring      return "you told me " & paramstring   end myapplescripthandler 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -