Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 4 of 4

Thread: Paste Chart From Sheet, Move To Next Slide

  1. #1
    Join Date
    26th November 2009
    Posts
    3

    Paste Chart From Sheet, Move To Next Slide

    I have an Excel spreadsheet with one chart per sheet and an open Powerpoint presentation with one slide created for each of these charts. What I am trying to do is create a macro to copy the first chart in to the first slide of Powerpoint and then go to the next sheet in Excel and the next slide in Powerpoint (note: I do not want to add a new slide, only to go to the next one) so I can repeat the macro again.

    Everything in my code is working perfectly except for the part where I need to switch to the next slide. I've tried various things and I've searched the internet but can't find a solution, can anyone help?

    I am a beginner to this and I realize this is probably a simple solution but I can't figure it out for the life of me.

    Thanks in advance!

    VB:
    Sub PasteChartintoPP2() 
         '
         ' PasteChartintoPP Macro
         ' Keyboard Shortcut: Ctrl+Shift+A
         
        Dim PPApp As PowerPoint.Application 
        Dim PPPres As PowerPoint.Presentation 
        Dim PPSlide As PowerPoint.Slide 
        Dim PresentationFileName As Variant 
         
         ' Reference existing instance of PowerPoint
        Set PPApp = GetObject(, "Powerpoint.Application") 
         ' Reference active presentation
        Set PPPres = PPApp.ActivePresentation 
         
         ' Reference active slide
        Set PPSlide = PPPres.Slides _ 
        (PPApp.ActiveWindow.Selection.SlideRange.SlideIndex) 
         
         ' Copy chart in sheet and go to next sheet
        ActiveSheet.ChartObjects("Chart 1").Activate 
        ActiveChart.ChartArea.Copy 
        ActiveSheet.Next.Select 
         
         ' Paste chart
        PPSlide.Shapes.Paste.Select 
         ' Align pasted chart
        PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True 
        PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True 
         
        PPApp.ActiveWindow.Selection.ShapeRange.ScaleWidth 1.39, msoFalse, msoScaleFromTopLeft 
        PPApp.ActiveWindow.Selection.ShapeRange.ScaleWidth 1.35, msoFalse, msoScaleFromBottomRight 
        PPApp.ActiveWindow.Selection.ShapeRange.ScaleHeight 1.6, msoFalse, msoScaleFromTopLeft 
         
         ' Go to next slide in presentation
        PPApp.ActiveWindow.View.Next 
         
         ' Clean up
        Set PPSlide = Nothing 
        Set PPPres = Nothing 
        Set PPApp = Nothing 
         
         
         
    End Sub 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    18th January 2009
    Posts
    63

    Re: Paste Chart From Sheet, Move To Next Slide

    Try this line:

    VB:
     
    Activewindow.View.GotoSlide ActiveWindow.View.Slide.slideindex + 1 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    26th November 2009
    Posts
    3

    Re: Paste Chart From Sheet, Move To Next Slide

    I get:
    "Compile error:
    Invalid qualifier"

    With ".View" highlighted.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    26th November 2009
    Posts
    3

    Re: Paste Chart From Sheet, Move To Next Slide

    Aha! Got it figured out (thanks to your help).

    I altered the text a little bit and wrote out:

    VB:
    PPApp.ActiveWindow.View.GotoSlide (PPApp.ActiveWindow.View.Slide.SlideIndex + 1) 
    
    
    And it works like a charm now, thanks for the help!

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Move Around Sheet & Copy & Paste
    By Ken Monville in forum EXCEL HELP
    Replies: 11
    Last Post: December 30th, 2006, 01:00
  2. Find, Then Move, Then Paste In Vba
    By DanMiller in forum EXCEL HELP
    Replies: 2
    Last Post: November 29th, 2006, 15:48
  3. Selecting a slide or putting a slide in view
    By bwells in forum Excel and/or Powerpoint Help
    Replies: 11
    Last Post: August 12th, 2006, 01:30
  4. make text/object move around in the slide show
    By Tee in forum Excel and/or Powerpoint Help
    Replies: 1
    Last Post: March 10th, 2006, 23:29

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
  •  
porno