+ Reply to Thread
Results 1 to 4 of 4

Excel VBA fails to insert a picture file (.jpg) into PowerPoint

  1. #1
    Registered User
    Join Date
    03-15-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Excel VBA fails to insert a picture file (.jpg) into PowerPoint

    First let me start by saying thank you for your time and effort to help me solve this problem.

    The attached excel workbook builds a power point (3 slides), inserts a text box into slide 1 with text from the excel and inserts a picture (.jpg) into slide 2. Everything works except after the picture inserts a 'Type Mismatch' run time error triggers. The line of code that errors was generated by the macro generator in powerpoint but using it in Excel VBA fails (I have the PowerPoint reference switched on). Here is a snipped of the code so you don't have to open the workbook but the workbook does a better job of showing the problem. The 3rd line from the bottom up triggers the runtime error 'Run-time error 13, Type Mismatch'. I checked the path and filename like crazy, I don't think that's the problem. Thanks again for your help.

    Please Login or Register  to view this content.
    Last edited by MrHockey; 11-06-2010 at 02:02 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Excel VBA fails to insert a picture file (.jpg) into PowerPoint

    Try this variant.

    Please Login or Register  to view this content.
    Martin

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: Excel VBA fails to insert a picture file (.jpg) into PowerPoint

    Change the declaration of the oPicture object.
    You also need to alter the reference in order to center the picture

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    03-15-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2003
    Posts
    37

    Re: Excel VBA fails to insert a picture file (.jpg) into PowerPoint

    Thanks Martin and Andy, that did the trick. When jumping back and forth between Office apps, it's important to qualify the 'with' statement for which ever office app is being used. My diagnostic skills were weak on this but with your help I'll be sure to watch for this in the future. I really appreciate your help, I was truely stuck on this. Thanks again!

+ 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.6.0 RC 1