Export Picture from Excel 2007 to PowerPoint 2007

Rating 4.00 out of 5

I have been working on a lot of MS-Excel macros and I am going to share one small tutorial on how to copy and paste an image/picture from an excel sheet to power point presentation. Following is the VBA code to carry out the same. Copy and paste the code in the VBE (Visual Basic Editor) of your MS-Excel workbook, which can be accessed by pressing Alt+F11. Or download the file I created for this, Enable Macros by clicking Options (which appears near the formula bar) as soon as you open the file and click on Try Me command button.

Public Sub Export_Excel_Picture_to_PowerPoint()
'Assign False to AddingSlides variable if you don`t want to end an extra slide
Dim AddingSlides As Boolean
AddingSlides = True
'Requires a reference to the Microsoft PowerPoint Library via the Tools - Reference menu in the VBE
Dim ppApp As PowerPoint.Application
Dim ppSlide As PowerPoint.Slide
Application.ScreenUpdating = False
'Look for existing instance
On Error Resume Next
Set ppApp = GetObject(, "PowerPoint.Application")
On Error GoTo 0
'Create new instance if no instance exists
If ppApp Is Nothing Then
Set ppApp = New PowerPoint.Application
End If

'Add a presentation if none exists
If ppApp.Presentations.Count = 0 Then
End If

'Make the instance visible
ppApp.Visible = True

'Check that a slide exits, if it doesn't add 1 slide. Else use the last slide for the paste operation
If ppApp.ActivePresentation.Slides.Count = 0 Then
Set ppSlide = ppApp.ActivePresentation.Slides.Add(1, ppLayoutBlank)
If AddingSlides Then
'Appends slides to end of presentation and makes last slide active
ppApp.ActivePresentation.Slides.Add ppApp.ActivePresentation.Slides.Count + 1, ppLayoutBlank
ppApp.ActiveWindow.View.GotoSlide (ppApp.ActivePresentation.Slides.Count)
Set ppSlide = ppApp.ActivePresentation.Slides(ppApp.ActivePresentation.Slides.Count)
'Sets current slide to active slide
Set ppSlide = ppApp.ActiveWindow.View.Slide
End If
End If

'Activate the Excel Sheet and copy the concerned picture from it.
'You may need to change the details here as per the workbook you need to open, the sheet and the picture name
ActiveSheet.Shapes("Picture 1").CopyPicture

'pasting the picture

'Adjusting the chart on the slide
ppApp.ActiveWindow.Selection.ShapeRange.ScaleWidth 1, msoFalse, msoScaleFromTopLeft
ppApp.ActiveWindow.Selection.ShapeRange.ScaleHeight 1, msoFalse, msoScaleFromTopLeft
ppApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, msoTrue
ppApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, msoTrue
Application.ScreenUpdating = True

End Sub

Word of Caution: To execute this code you need to give a add a reference to one of the libraries. Go to Tools -> References and add Microsoft Powepoint 12.0 Object Library.

There is the code, which is simple to understand. Please feel free to comment and ask your queries.

Cheers! 🙂


About Anshuman

Computer Engineer ... MBA .. Endurance Runner ... Physics Geek ... Genius
Bookmark the permalink.


  1. Ho do you define the picture 1? Do you name it as a variable?

    • Hi Igshaan,
      Picture 1 is the name of the Picture, something that you see in the Name Box. It is not a variable. You can select the Picture and see the Name Box to find out the name and use it in the code.

  2. Hi Anshuman.thanks for the code..I need your help in positioning the picture in power point such that it covers the entire slide.Right now it isn’t

    • Hi Mohan Krishna.. Firstly , thanks for visiting the site and it is good to know that you found the code helpful
      well you can position the image specifically by the top and left attributes of the shaperange object
      So in place of line 53,54 write these two statements
      ppApp.ActiveWindow.Selection.ShapeRange.Top = 1
      ppApp.ActiveWindow.Selection.ShapeRange.Left = 2
      In place of 1 and 2 you can give the exact position. The units will be different, so you need to do trial and error here to know the exact place where you need the image.


  3. Hi Anshuman,
    In your code you have handeled only one Picture.
    I am writing one macro where I am taking a screen shots of 12 different webpages(count may change) then resizing it and pasting those 12 images on excel sheet.
    Below is the size of each images
    Selection.ShapeRange.ScaleHeight 0.47, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleWidth 0.33, msoFalse, msoScaleFromTopLeft

    Now I want to paste all 12 images to ppt to make a presentation.
    Each slide must contain only 4 images so for 12 images 3 slides should be created. Just to make it clear below is the slide I have shown with the help of * . “*” within the slide are the iamges
    * *
    * * * *
    * *
    * * * *
    * *

  4. Pingback: Resizing images using VBA

Liked it? Share Your Thoughts!

This site uses Akismet to reduce spam. Learn how your comment data is processed.