+ Reply to Thread
Results 1 to 2 of 2

Excel to Powerpoint copy images

  1. #1
    Registered User
    Join Date
    03-17-2009
    Location
    Texas, america
    MS-Off Ver
    Excel 2007
    Posts
    2

    Excel to Powerpoint copy images

    Hi All,

    Am trying to load some excel data into already existing powerpoint file as images. These images need to be posted on specific slide numbers and this is where I'm having trouble with. I'm able to copy the data from excel and also make it paste to Powerpoint from Slide 1 but not able to paste it to specific slides. Below is the code:


    Sub DeleteAllPictures()


    Dim lngTemp As Long
    Dim lngCount As Long
    Dim PowerPointApp As PowerPoint.Application
    Set PowerPointApp = New PowerPoint.Application
    PowerPointApp.Visible = True
    Dim rng As Excel.range
    Dim myShapeRange As PowerPoint.ShapeRange
    Dim mySlide As PowerPoint.Slide
    Dim lRow As Long
    Dim lol As Long
    Dim arrSlides() As Variant
    arrSlides = Array(1, 4, 6) ' Defining the array
    Dim ab As Integer
    Dim myPresentation As PowerPoint.PresentationSet myPresentation = PowerPointApp.Presentations.Open("XXXX\04.30.pptx")


    For Each mySlide In myPresentation.Slides
    For lngCount = mySlide.Shapes.Count To 1 Step -1
    With mySlide.Shapes(lngCount)
    If .Type = msoPicture Then
    .Delete
    End If
    End With
    Next
    Next (Using this part of the code to delete pictures already existing on the powerpoint)



    lCol = 23
    lRow = 3


    If lCol < 134 Then

    Set rng = ThisWorkbook.ActiveSheet.range("B" & lRow & ":" & "P" & lCol)
    rng.Copy

    '' Below part is where I'm having issues. Here I'm trying to loop through the array & only when the condition of slide #1, 4, 6 matches then it should execute the "copy paste piece of code. However not able to do that.

    For ab = LBound(arrSlides) To UBound(arrSlides) 'Each ab In arrSlides

    ''Set myslides = PowerPointApp.ActivePresentation.Slides(arrSlides)

    ''Set myShapeRange = ActivePresentation.Slides.Shapes.PasteSpecial(DataType:=ppPasteBitmap)
    ''Set mydocument = PowerPointApp.ActivePresentation.Slides
    Set myShapeRange = arrSlides(ab).Shapes.PasteSpecial(DataType:=ppPasteBitmap)
    myShapeRange.Left = 0.24 * 72
    myShapeRange.Top = 1.43 * 72
    myShapeRange.Height = 4.26 * 72
    myShapeRange.Width = 9.2 * 72
    CutCopyMode = False
    lCol = lCol + 22
    lRow = lRow + 22

    Next ab
    End If
    'End With

    End Sub

    Other general question I have.

    a) Is there a way to know the Slide ID of each slide? If yes, is there a way to do this without macros? Just by GUI?

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Excel to Powerpoint copy images

    Use copyaspicture rather than copy
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Insert images in a pre-powerpoint slide
    By PRADEEPB270 in forum PowerPoint Formatting & General
    Replies: 2
    Last Post: 01-08-2014, 05:39 AM
  2. VBA code for finding images and merge to PowerPoint
    By hobbes_ in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-26-2012, 04:02 AM
  3. VBA code for data and images from Excel to PowerPoint
    By hobbes_ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2012, 06:02 AM
  4. copy chart from Excel to Powerpoint
    By Hoffperson in forum Excel General
    Replies: 1
    Last Post: 12-06-2005, 08:15 PM
  5. [SOLVED] How do I copy a screen in Excel for use in Powerpoint?
    By Bess in forum Excel General
    Replies: 4
    Last Post: 09-01-2005, 12:05 PM

Tags for this Thread

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