Results 1 to 2 of 2

Thread: MAC VBA to copy values from Excel to PPT

  1. #1
    VBAX Newbie
    Apr 2019

    MAC VBA to copy values from Excel to PPT

    Hi There

    I am trying to port a macro from windows to mac vba.
    The macro opens an excel workbook, opens a ppt template, and copies values from one to the other.
    Both files are opened successfully by file dialog prompt.

    However, when the (excel) script tries to interact with the (open) powerpoint file, the excel script just dies:

    //this script is run in excel workbook
    Sub TestPpt()

    'Step 1: Declare your variables
    Dim DestinationPPT As String
    Dim PP As PowerPoint.Application
    Dim myPres As PowerPoint.Presentation
    Dim mySlide As PowerPoint.Slide
    Dim mySlides() As Variant

    Set PP = CreateObject("PowerPoint.Application")
    If PP Is Nothing Then Set PP = CreateObject(class:="PowerPoint.Application")

    DestinationPPT = "/Users/sysadministrator/Documents/End of Qstream Report/testpres.pptx"

    Set myPres = PP.Presentations.Open(DestinationPPT)

    Set myPres = PP.ActivePresentation

    //but dies on this line
    Set mySlide = myPres.Slides(1)

    mySlide.Shapes("insights_title").TextFrame.TextRange.Text = qsTitle

    End Sub

    Does anyone know if cross-app interaction like this is possible on a mac?


  2. #2
    1. I think you don't need to re-set myPres (remove or comment Set myPres = PP.ActivePresentation)

    2. Is there any slide in DestinationPPT?

    3. Try late binding instead of early binding.

    Don't have MAC machine to test it myself.

Posting Permissions

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