+ Reply to Thread
Results 1 to 4 of 4

Thread: Passing Data from Excel to PowerPoint via VBS?

  1. #1
    Registered User
    Join Date
    10-26-2009
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    11

    Passing Data from Excel to PowerPoint via VBS?

    Hello

    I have been working most of the day trying to get Excel to talk to PowerPoint. I am on Version 2007..

    What I want to do is run a macro in Excel, have that macro copy a few columns then .COPY so it will be in the clip board.

    I then want to switch to PowerPoint and Paste-Special as a Windows Meta File.

    Does anyone have a short code snipit perhaps they could share?

    Thanks in advance.

  2. #2
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,004

    Re: Passing Data from Excel to PowerPoint via VBS?

    Try this

    Sub Test()
    Dim PPApp As PowerPoint.Application
    Dim PPPRes As PowerPoint.Presentation
    Dim PPSlide As PowerPoint.Slide
    Dim pptLayout As PowerPoint.CustomLayout
    
    Dim MyShapes As PowerPoint.Shapes
    
    Set PPApp = New PowerPoint.Application
    PPApp.Visible = msoTrue
    Set PPPRes = PPApp.Presentations.Add
    Set pptLayout = PPPRes.SlideMaster.CustomLayouts(1)
    
    
    Set PPSlide = PPPRes.Slides.AddSlide(1, pptLayout)
    
    
    Range("A1:A2").Copy
    
    
    Set MyShapes = PPPRes.Slides(1).Shapes
    MyShapes.PasteSpecial(2).Select
    
    
    End Sub
    You will need to set up a reference in Excel to the Microsoft PowerPoint Object Library.
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

  3. #3
    Registered User
    Join Date
    10-26-2009
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Passing Data from Excel to PowerPoint via VBS?

    Thank you for the quick reponse. Can you tell me how I would/could setup a reference in excel?

    I see you have:
    Range("A1:A2").Copy

    Will that 'Paste Special'? I am wanting to copy images from Excel such as graphs into PowerPoint.

    thanks

  4. #4
    Forum Guru mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    3,004

    Re: Passing Data from Excel to PowerPoint via VBS?

    Set up a reference by going into the VBA editor and selecting Tools - References and then Microsort Powerpoint (12) from the long list of libraries.

    Your original post didn't specify what type of thing you wanted to copy from Excel. However, the method should work for most things that you might want to copy.
    Martin

    Eighty Twenty Spreadsheet Automation http://homepage.ntlworld.com/martin.rice1/ for all your Excel customisation and consulting needs.

    If my solution has saved you time and/or money, please consider donating to Cancer Research UK.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0