+ Reply to Thread
Results 1 to 1 of 1

Export especific Cells from different sheets to slides in PPT

Hybrid View

KYCH Export especific Cells from... 03-08-2014, 04:41 PM
  1. #1
    Registered User
    Join Date
    03-03-2014
    Location
    Luxembourg
    MS-Off Ver
    Excel 2007
    Posts
    1

    Export especific Cells from different sheets to slides in PPT

    Hi,

    It took me a while surfing several days, and checking some codes, I have 0 experience, this is why i want to share it with others and thanks for all the experts that help us.

    Here is the code that enables you copy especific cells ranges from the same, or different sheets to slides (in the same order that is written in the code). As well alignment ** the exported images in PPT slide. I have modified the original code from 'By Christos Samaras, 'http://www.myengineeringworld'. Also available in that web, export excel table to tables in PPT. However the script hereunder has been changed to copy cells and paste them as images in PPT. As Usual needs to be activated Micros**t Powerpoint.




    Option Explicit
    
        'Both subs require a reference to Micros**t PowerPoint xx.x Object Library.
        'where xx.x is your **fice version (11.0 = 2003, 12.0 = 2007 and 14.0 = 2010).
    
        'Declaring the necessary Power Point variables, whick are used in both subs.
        Dim pptApp          As PowerPoint.Application
        Dim pptPres         As PowerPoint.Presentation
        Dim pptSlide        As PowerPoint.Slide
        Dim pptSlideCount   As Integer
    
    Sub TablesToPowerPoint()
        
        'Exports the range A1:C5 from each sheet to a new Power Point
        'presentation as table. Each range is copied to a new slide.
            
        'By Christos Samaras http://www.myengineeringworld.net
       'Modified by Karla Coello
    
            
        Dim ws As Worksheet
              
        'Open Power Point and create a new presentation.
        Set pptApp = New PowerPoint.Application
        Set pptPres = pptApp.Presentations.Add
        
        'Show the Power Point application.
        pptApp.Visible = True
    
        'Transfer the data from the selected range from the same or different sheets,
        'to the Power Point presentation.
        'the order specified per each line will appear in consecutive slide in ppt
    
        Sheet1.Activate
        ExcelTableToPowerPoint (ActiveSheet.Range("B1:D17"))
        Sheet4.Activate
        ExcelTableToPowerPoint (ActiveSheet.Range("B8:W25"))
        Sheet2.Activate
        ExcelTableToPowerPoint (ActiveSheet.Range("B7:H19"))
        Sheet2.Activate
        ExcelTableToPowerPoint (ActiveSheet.Range("B20:H29"))
        Sheet2.Activate
        ExcelTableToPowerPoint (ActiveSheet.Range("B30:H50"))
        
        'Return the "focus" to the frist sheet.
        ActiveWorkbook.Worksheets(1).Activate
        
        'Infrom the user that the macro finished.
        MsgBox "The report was sent to PPT!", vbInformation, "Done"
        
    End Sub
    Private Sub ExcelTableToPowerPoint(xlRange As Range)
    
    'Copies an Excel Table as picture to Power Point.
    
    'By Christos Samaras
    'http://www.myengineeringworld....
    
    'Check if the range is valid.
    If Application.Intersect(xlRange, ActiveSheet.Range("A1:XFD1048576")) Is Nothing Then
    MsgBox "Sorry, the range you selected is not valid!", vbCritical, "Invalid range"
    Exit Sub
    End If
    
    
    'Copy the range.
    xlRange.CopyPicture
    
    'Count the slides and add a new one after the last slide.
    pptSlideCount = pptPres.Slides.Count
    Set pptSlide = pptPres.Slides.Add(pptSlideCount + 1, ppLayoutBlank)
    
    'Paste the picture and adjust its position
    With pptSlide.Shapes.Paste
    .Align msoAlignCenters, True
    .Top = 50
    .Left = 10
    .Width = 700
    
    End With
    
    
    End Sub
    Last edited by alansidman; 03-11-2014 at 02:29 PM. Reason: the complete code was not added, a part was missing.

+ 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. Export sheets copy/paste Values And Formats with merge cells
    By creusemeninge in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2013, 09:55 AM
  2. Replies: 2
    Last Post: 01-06-2011, 07:35 PM
  3. copy cells to powerpoint slides
    By just_some_guy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-08-2010, 09:34 AM
  4. Hidding especific sheet
    By mik00725 in forum Excel General
    Replies: 3
    Last Post: 06-28-2006, 01:52 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