+ Reply to Thread
Results 1 to 3 of 3

Export Excel Area to PowerPoint

  1. #1
    Registered User
    Join Date
    01-13-2017
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    31

    Export Excel Area to PowerPoint

    Hello,

    I am looking for a VBA-script which helps me to export areas of Excel to PowerPoint. I found a template and tried to do a few changes but did not manage to achieve everything I want.

    This is working at the moment: Each of these ranges are copied to a new PowerPoint file.
    Pic1.JPG

    I think it would be great to add more features.
    Pic2.JPG

    C. Decide if you want to add a new slide or select which slide you want to add the picture to.
    D. Change scale of the picture
    E. Change position horizontally.
    F. Change position vertically.
    G. Change the title of the slide.
    I1. Create a new presentation or let select a existing one.
    I2. Is it possible to store a template and use if you create a new presentation?

    I think it would be best to use True/False if possible to make it work with buttons. What do you think?

    It's just an idea I had and I am open for suggestions or changes/additions. How to get the best picture quality?
    EDIT: I tried to export a graph to PowerPoint and the quality is not good. I think it would be best to export a .png if possible.

    It would be fantastic if you help me.
    Thank you very much!
    Bris
    Last edited by brisardo; 06-20-2017 at 07:27 AM.

  2. #2
    Registered User
    Join Date
    01-13-2017
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    31

    Re: Export Excel Area to PowerPoint

    Here are some things which could help but I can't get it to work. The quality of the image is mucht better than the code in the attached file.

    Option Explicit

    Dim PP As Object
    Dim PP_File As Object
    Dim PP_Slide As Object

    Private Sub CopyandPastetoPPT(myRangeName As String, myTitle As String, myScaleHeight As Single, myScaleWidth As Single)
    Dim NextShape As Integer
    Dim ReportDate As String

    ReportDate = Range("Headline1").value & "" & Range("Headline2").value & ""
    Application.GoTo Reference:=myRangeName
    Selection.CopyPicture Appearance:=xlScreen, format:=xlPicture
    Range("A1").Select
    PP.ActivePresentation.Slides.Add PP.ActivePresentation.Slides.Count + 1, 11
    Set PP_Slide = PP_File.Slides(PP.ActivePresentation.Slides.Count)
    PP_Slide.Shapes.Title.TextFrame.TextRange.text = ReportDate & myTitle
    NextShape = PP_Slide.Shapes.Count + 1
    PP_Slide.Shapes.PasteSpecial 2
    PP_Slide.Shapes(NextShape).ScaleHeight myScaleHeight, 2
    PP_Slide.Shapes(NextShape).ScaleWidth myScaleWidth, 1
    PP_Slide.Shapes(NextShape).Left = PP_File.PageSetup.SlideWidth \ 2.5 - PP_Slide.Shapes(NextShape).Width \ 2
    PP_Slide.Shapes(NextShape).Top = 65

    End Sub

    Sub ExportToPPT()
    Dim ActFileName As Variant
    Dim ScaleFactor As Single

    On Error GoTo ErrorHandling
    ActFileName = Application.GetOpenFilename("Microsoft PowerPoint-Files (*.pptx), *.pptx")
    ScaleFactor = Range("myScaleFactor").value
    Set PP = CreateObject("Powerpoint.Application")
    If ActFileName = False Then
    PP.Activate
    PP.Presentations.Add
    Set PP_File = PP.ActivePresentation
    Else
    PP.Activate
    Set PP_File = PP.Presentations.Open(ActFileName)
    End If
    PP.Visible = True
    CopyandPastetoPPT "Area01", Range("myInputStartTitles").Offset(1, 0).value, ScaleFactor, ScaleFactor
    ' CopyandPastetoPPT "Area02", Range("myInputStartTitles").Offset(2, 0).Value, ScaleFactor, ScaleFactor
    ' CopyandPastetoPPT "Area03", Range("myInputStartTitles").Offset(3, 0).Value, ScaleFactor, ScaleFactor
    ' CopyandPastetoPPT "Area04", Range("myInputStartTitles").Offset(4, 0).Value, ScaleFactor, ScaleFactor
    ' CopyandPastetoPPT "Area05", Range("myInputStartTitles").Offset(5, 0).Value, ScaleFactor, ScaleFactor
    Set PP_Slide = Nothing
    Set PP_File = Nothing
    Set PP = Nothing

    Exit Sub

    ErrorHandling:

    Set PP_Slide = Nothing
    Set PP_File = Nothing
    Set PP = Nothing
    MsgBox "Error No.: " & Err.number & vbNewLine & vbNewLine & "Description: " & Err.Description, vbCritical, "Error"

    End Sub


  3. #3
    Registered User
    Join Date
    01-13-2017
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    31

    Re: Export Excel Area to PowerPoint

    Hi all,

    do you think the idea is not worth your time or is there something similar out there?
    I would really appreciate your help

    Thank you,
    bris

+ 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. VBA to copy Excel in to PowerPoint, with flexible slide numbers
    By BillDoor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-21-2016, 08:39 AM
  2. Export from Excel to powerpoint using VBA
    By mayoorsubbu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-31-2015, 10:19 AM
  3. Trying to export results from a PowerPoint quiz to Excel
    By DPWM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-09-2013, 01:54 PM
  4. Hiding focus of PowerPoint export
    By hoffey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2009, 04:59 PM
  5. Export data from Excel to PowerPoint
    By nalfin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-01-2009, 09:46 AM
  6. Excel to Powerpoint export
    By webbug08 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-05-2009, 09:41 AM
  7. Help with VBA export of cells to PowerPoint
    By JOTS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-15-2006, 01:15 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