1

I would like to zip files under Microsoft Excel 2016 for Mac Version 15.23.2 (160624).

I wrote an application, which zips all the files, that are passed on as command line parameters. Now I have to call that application from VBA and provide the paths to files as command line parameters. I started with this answer.

When using the Shell command, I get

runtime error 53 (file not found)

But since that source says, that this command does not accept command line parameters I can't use it anyway.

When using the MacScript command, I get

runtime error 5 (invalid procedure call or invalid argument).

I tried with the system() function from the standard C library as suggested in the linked answer. Here I got following test results:

Private Declare Function system Lib "libc.dylib" (ByVal command As String) As Long

Call system("open -a Safari --args http://www.google.com") 'Example 1: starts Safari, but does not load google
Call system("open -a Safari http://www.google.com")        'Example 2: starts Safari and loads google

Call system("open -a Zipper")                   'starts my application
Call system("open -a Zipper arg1 arg2")         'does not even start my application!
Call system("open -a Zipper --args arg1 arg2")  'starts my application, but without passing the parameters arg1 and arg2

What do I have to do to start my application with the command line parameters provided?

Another idea would be, to provide the zipping functionality in a dylib library. But how can I create such a library? Is this possible with Xcode and Swift? Or is there such a file available and how can I use it, if so (I just found a question without an answer here).

Community
  • 1
  • 1
PjotrC
  • 311
  • 1
  • 6
  • 16

0 Answers0