Advertisement

08.01.2007 at 09:34AM PDT, ID: 22735159
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Referencing Powerpoint graphs using VB in an Excel macro

Asked by skinnyl in Microsoft Powerpoint Presentation Software, Visual Basic Programming, Microsoft Excel Spreadsheet Software

Tags: , , , ,

Hey all!

I'm using the below in a macro to automatically port data from excel into powerpoint. The code lies in the excel workbook.

It works well but i have got to the stage where there are multiple graphs on one slide and i'm not sure how to reference them. at the moment the below just uses the slide reference (oPPTApp.ActivePresentation.Slides(3))  to get the graph.

Question- is it possible to reference more than one graph using VB?  

Cheers

Jack.

Sub UpdateGraph()
   Dim oPPTApp As PowerPoint.Application
   Dim oPPTShape As PowerPoint.Shape
   Dim oPPTPres As PowerPoint.Presentation
   Dim rngNewRange As Excel.Range
   Dim oGraph As Object


'
' Set oPPTApp to PowerPoint by creating a new instance of PowerPoint.
' If PowerPoint is already open, you would instead use the GetObject
' method instead.
'
   Set oPPTApp = CreateObject("PowerPoint.Application")
'
' Set PowerPoint to be Visible.
'
   oPPTApp.Visible = msoTrue
'
' Open Presentation1.ppt from My Documents.
'
   oPPTApp.Presentations.Open "C:\My Documents\Presentation1.ppt"
'
' Set rngNewRange to the collection of cells in the active Excel
' workbook and active sheet.
'
   Set rngNewRange = ActiveSheet.Range("E11:E17")
'
' Select the range then copy it.
'
   rngNewRange.Select
   rngNewRange.Copy
'
' On slide one of Presentation1.ppt, loop through each shape.
'
   With oPPTApp.ActivePresentation.Slides(3)
      For Each oPPTShape In .Shapes
'
' Check to see whether shape is an OLE object.
'
         If oPPTShape.Type = msoEmbeddedOLEObject Then
'
' Check to see whether OLE object is a Graph 2000 object. The ProgID
' is case sensitive.
'
            If oPPTShape.OLEFormat.ProgId = "MSGraph.Chart.8" Then
'
' Set oGraph to the Graph object on the slide.
'
               Set oGraph = oPPTShape.OLEFormat.Object
'
' Paste the cell range into the upper leftmost cell of the graph
' datasheet. This position is designated "00" (two zeros). To designate
' a range to start in the second row, first column, you would use "01".
' Likewise first row, second column is "A0". This will also link the
' datasheet to the Excel Workbook cell range. If you do not want to
' link to the Workbook, just omit the word "True". The default
' choice for the Paste method is "False".
'
               oGraph.Application.DataSheet.Range("A1").Paste False

            End If

         End If
        Next oPPTShape
    End With
End SubStart Free Trial
[+][-]08.01.2007 at 01:36PM PDT, ID: 19612641

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Powerpoint Presentation Software, Visual Basic Programming, Microsoft Excel Spreadsheet Software
Tags: powerpoint, excel, macro, vb, graph
Sign Up Now!
Solution Provided By: harfang
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.02.2007 at 01:43AM PDT, ID: 19615327

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.02.2007 at 02:02AM PDT, ID: 19615393

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.02.2007 at 06:59PM PDT, ID: 19622158

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.05.2007 at 10:26AM PDT, ID: 19634761

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32