Results 1 to 4 of 4

Excel VBA - Copy charts from Excel to PowerPoint (DONE) and make it Centre Horizontally

Threaded View

dluhut Excel VBA - Copy charts from... 11-04-2016, 09:31 AM
dflak Re: Excel VBA - Copy charts... 11-04-2016, 12:00 PM
dluhut Re: Excel VBA - Copy charts... 11-04-2016, 03:44 PM
dflak Re: Excel VBA - Copy charts... 11-04-2016, 04:15 PM
  1. #1
    Valued Forum Contributor
    Join Date
    04-13-2011
    Location
    Ottawa, Canada
    MS-Off Ver
    365
    Posts
    1,129

    Excel VBA - Copy charts from Excel to PowerPoint (DONE) and make it Centre Horizontally

    Hello,

    Below I have the following code to copy and paste to from Excel to PowerPoint as Bitmap.

    What I want to do now is that, how do I make the chart to centre horizontally.

    As well, notice that I have make the height to change first, so that the width of the chart is 'automatically resize as well due to the "LockAspectRatio"

    Set ppSlide = myPresentation.Slides(8)
    Sheets("PPT-page8").Range("A1:Z26").Copy
    ppSlide.Shapes.PasteSpecial (ppPasteBitmap)
    PowerPointApp.ActiveWindow.Selection.ShapeRange.LockAspectRatio = True
    PowerPointApp.ActiveWindow.Selection.ShapeRange.Height = 329.76
    PowerPointApp.ActiveWindow.Selection.ShapeRange.Left = AUTOMATICALLY CENTRE HORIZONTALLY
    PowerPointApp.ActiveWindow.Selection.ShapeRange.Top = 72

    I googled and was able to find a 'solution', but no matter how I try to incorporate it, it doesn't work.

    'Center the Object Horizontally and Vertically
        With ActivePresentation.PageSetup
            Obj_Left = Obj.Left
            Obj_Top = Obj.Top
            
            'Center Horizontally
                Obj.Left = (.SlideWidth \ 2) - (Obj.Width \ 2)
        
            'Center Vertically
                Obj.Top = (.SlideHeight \ 2) - (Obj.Height \ 2)
                
        End With
    Given that my width is automatically resize, will the above code 'Obj.Width' be able to capture the 'latest' width once the PowerPointApp.ActiveWindow.Selection.ShapeRange.Height = 329.76 is set?

    PS: Macro is ran on Excel and not in PowerPoint
    Last edited by dluhut; 11-04-2016 at 09:34 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy Excel Charts to PPT (Minimum 4 Charts on each PowerPoint Page)
    By E5254730 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-01-2016, 02:36 PM
  2. Copy charts and/or Range (including chart) from Excel to Powerpoint
    By dluhut in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2016, 12:35 AM
  3. Copy Image (not charts) from excel to powerpoint
    By Anum86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2015, 06:20 AM
  4. VBA to copy charts from excel to powerpoint
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-05-2013, 11:20 AM
  5. Copy excel charts/graphs to Powerpoint with/without copying worksheet
    By ThomasCarter in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 11-12-2012, 09:05 AM
  6. [SOLVED] Copy Named charts in Excel to specific slide in Powerpoint
    By allstarrunner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2012, 09:10 AM
  7. Copy charts from excel to powerpoint template
    By Pana1 in forum Excel General
    Replies: 0
    Last Post: 07-13-2010, 05:38 AM

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