locked
Need help using MacScript in Excel 365 RRS feed

  • Question

  • I have written a macro-enabled workbook for Windows, and am now trying to make it also work on Mac, as several people who need to use it only have Mac computers.  (I have the most recent version of Office 365 for Mac.)  I am not very familiar with Mac, so I'm running into some difficulties.

    I am trying to combine multiple PDF files into a single PDF file using VBA in Excel.  I ran across a forum post a couple of months back that talked about using Python from Terminal to accomplish this.  I am trying to get this to work, but I'm in over my head.

    Here's the code I have:

    Dim myMacScript As String
    
    myMacScript = "do shell script ""/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py -o " & PDFName & ".pdf 1.pdf 2.pdf"""
    
    MacScript (myMacScript)

    I am combining things I have seen on different websites and forum posts to try to do this, but obviously there is something I am doing wrong.  On the last line, I get Runtime Error 5: Invalid procedure call or argument

    Note: I give the user the choice of the name of the PDF file that is being created, so the PDFName variable holds whatever name they input.

    FYI - the site where I found info about using Python on Terminal to combine PDF files is here:

    http://cmdlinetips.com/2016/03/how-to-join-pdf-files-in-mac-on-terminal/


    • Edited by mcomp72 Friday, January 4, 2019 3:55 AM
    Friday, January 4, 2019 3:53 AM