+ Reply to Thread
Results 1 to 2 of 2

Please help me to fix the code to copy picture from active worksheet into the powerpoint

Hybrid View

  1. #1
    Registered User
    Join Date
    12-16-2015
    Location
    kENTUCKY
    MS-Off Ver
    2010
    Posts
    5

    Please help me to fix the code to copy picture from active worksheet into the powerpoint

    Thanks to Alpha frog for helping me with code below.

    I need to alter it again, so need you Guys help

    What this code does-
    Ok this code copies chart from excel and pasted into a new PPT

    what I want it to do now-
    I want the code to be edited so that in place of a chart it copies the picture in the excel as I am having picture now in excel sheet rather then chart.

    Sub PushChartsToPPT()
     'Set reference to 'Microsoft PowerPoint 12.0 Object Library'
     'in the VBE via Tools > References...
     '
     Dim ppt As PowerPoint.Application
     Dim pptPres As PowerPoint.Presentation
     Dim pptSld As PowerPoint.Slide
     Dim pptCL As PowerPoint.CustomLayout
     Dim pptShp As PowerPoint.Shape
    
     Dim cht As Chart
     Dim ws As Worksheet
     Dim i As Long
    
     'Get the PowerPoint Application object:
     Set ppt = CreateObject("PowerPoint.Application")
     ppt.Visible = msoTrue
     Set pptPres = ppt.Presentations.Add
    
     'Get a Custom Layout:
     For Each pptCL In pptPres.SlideMaster.CustomLayouts
     If pptCL.Name = "Title and Content" Then Exit For
     Next pptCL
    
     'Copy ALL charts embedded in Active WorkSheet:
     Set ws = ActiveSheet
     For i = 1 To ws.ChartObjects.Count
     Set pptSld = pptPres.Slides.AddSlide(pptPres.Slides.Count + 1, pptCL)
     pptSld.Select
    
     For Each pptShp In pptSld.Shapes.Placeholders
     If pptShp.PlaceholderFormat.Type = ppPlaceholderObject Then Exit For
     Next pptShp
    
     Set cht = ws.ChartObjects(i).Chart
     pptSld.Shapes(1).TextFrame.TextRange.Text = cht.ChartTitle.Text
     cht.ChartArea.Copy
     ppt.Activate
     pptShp.Select
     ppt.Windows(1).View.Paste
     Next i
     End Sub

  2. #2
    Registered User
    Join Date
    12-16-2015
    Location
    kENTUCKY
    MS-Off Ver
    2010
    Posts
    5

    Re: Please help me to fix the code to copy picture from active worksheet into the powerpoi

    waiting some please help

+ 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. Replies: 4
    Last Post: 07-03-2015, 04:27 AM
  2. Copy an Image from a User form Picture Box to Worksheet Picture Box
    By sledgehammer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2014, 11:39 AM
  3. Copy Excel Graphs to Powerpoint As Picture
    By Ajay_tippu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2014, 02:15 PM
  4. picture in a worksheet need copy of that sheet to moved to active workbook
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2014, 04:47 AM
  5. Replies: 13
    Last Post: 01-11-2013, 04:46 PM
  6. Copy Excel Data as Enhanced Metafile(Picture) to PowerPoint
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2008, 07:34 AM
  7. [SOLVED] Suppress double click behaviour when a picture on a worksheet is active/selected
    By David Cuthill in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2005, 08:06 PM

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