Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / August 2004

Tip: Looking for answers? Try searching our database.

Linking Excel Range to Pow.Pt. picture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kate - 31 Aug 2004 19:59 GMT
Hi,

I know this is a long shot, but I'm hoping SOMEBODY has
the answer....

I need to create a power point presentation that links to
an excel workbook.  The reason I need to link it is
because the numbers will change monthly, and the
presentation is distributed monthly.

So, I need to create a presentation that will:

1) have excel worksheets in it that link to defined ranges
in a workbook.
2) HOPEFULLY have the Pow.Pt. worksheet appear as a bitmap
(if not thats ok)
3) allow the Pow.Pt. SS (or the picture) to link to the SS
so that the image will change every month.

I know it's a long shot, but any help would be GREATLY
appreciated.

Thanks
Kate
Stephen Mayr - 31 Aug 2004 20:24 GMT
Hi, Kate

I recently did something like this using VBA. You can
update multiple objects using any number of excel files.

Does this sound like something you can use?

>-----Original Message-----
>Hi,
[quoted text clipped - 22 lines]
>Kate
>.
Kate - 31 Aug 2004 20:40 GMT
Absolutely, but I'm not too familiar with the specifics in
the VB code.  Do you have a copy of the code to use?

Thank you so much.

>-----Original Message-----
>Hi, Kate
[quoted text clipped - 34 lines]
>>
>.
Stephen Mayr - 31 Aug 2004 20:59 GMT
Here you go. You can repeat this code for each slide. This
code updates slide 1. I use the variable cnt to determine
which object it's on so that I know what Excel file to use.

Go over it and if you have specific questions, I'll try to
answer them.

Beginning of code
-----------------------------------------------------------

Public Const Range = "A1:AA15"
Public Const RangeMG = "C1:AA15"
Public Const Range2 = "B1:AA15"
Public Const CurMth = "Jul 2004"
Public Const PreMth = "Jun 2004"

Sub UpdateGraph()
  Dim oPPTApp As PowerPoint.Application
  Dim oPPTShape As PowerPoint.Shape
  Dim rngNewRange As Excel.Range
  Dim oGraph As Object
  Dim strPath As String
  Dim cnt As Integer
'
' 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
'
 
'---------------------------------------------------------
'                 Total Market Slides
'---------------------------------------------------------

'Repeat code starting here to update different slides
' On slide 1 of Presentation1.ppt, loop through each shape.

cnt = 0

  With oPPTApp.ActivePresentation.Slides(1)
     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
           cnt = cnt + 1

' Set rngNewRange to the collection of cells in the active
Excel
' workbook and active sheet.

           If cnt = 1 Then
              strPath = "C:\Test\Total\Chart1.xls"
              Workbooks.Open FileName:=strPath
              ActiveSheet.Range(Range).Select
              ' Select the range then copy it.
              Selection.Copy
            End If

           
           If cnt = 2 Then
              ActiveWorkbook.Close False
              strPath = "C:\Test\Total\Chart2.xls"
              Workbooks.Open FileName:=strPath
              ActiveSheet.Range(Range).Select
              ' Select the range then copy it.
              Selection.Copy
            End If
'
' Set oGraph to the Graph object on the slide.
'
              Set oGraph = oPPTShape.OLEFormat.Object
             
'Graph Titles
             
              If cnt = 1 Then
              oGraph.ChartTitle.Text = "Chart 1 Title" &
Chr(13) & "(Switch/Add Combined)" & Chr(13) & "Jan 2003 -
" & CurMth
              End If
             
              If cnt = 2 Then
              oGraph.ChartTitle.Text = "Chart 2 Title" &
Chr(13) & "Jan 2003 - " & PreMth & " (1 Month Lag to
distinguish)"
              End If
             
             
             
'
' 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
("00").Paste True
'update link
              oGraph.Application.Update
           End If

        End If
       
     
'
' Select the next shape on the slide.
'
     Next oPPTShape
  End With
 
ActiveWorkbook.Close False

'Paste copied code here to update different slides

End Sub
---------------------------------------------------------

End of code

>-----Original Message-----
>Absolutely, but I'm not too familiar with the specifics in
[quoted text clipped - 44 lines]
>>
>.
Kate - 31 Aug 2004 21:06 GMT
thanks so much!
>-----Original Message-----
>Here you go. You can repeat this code for each slide. This
[quoted text clipped - 192 lines]
>>
>.
Steve Rindsberg - 31 Aug 2004 21:05 GMT
> I know this is a long shot, but I'm hoping SOMEBODY has
> the answer....
[quoted text clipped - 15 lines]
> I know it's a long shot, but any help would be GREATLY
> appreciated.

If all the long shots were this short, it'd be an easy life indeed.

To link content from Excel to PPT:
Open your PPT file
Open your Excel file.  It must first have been saved at least once for this to
work.
Select the content in Excel and choose Edit, Copy from the main menu bar (or
press Ctrl+C)
Switch to PPT, go to the slide where you want the content to appear.
Choose Edit, Paste Special and click Link.

Done.  Size to taste.  Rightclick, choose Format and on the color tab choose
Recolor to remap Excel colors to PPT colors if you need to.

It won't be a bitmap -- actually it'll all be vector graphics and text, which
gives you better quality as a rule.

When you update the spreadsheet, PowerPoint will update the data in your PPT
file the the next time you open the PPT.

Signature

--
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA    www.PowerPointLive.com
================================================

Kurt - 31 Aug 2004 21:11 GMT
Kate,
Also have a look at www.take-off.as/datapoint if you want to have a ready
made solution or addon.
Kurt

> Hi,
>
[quoted text clipped - 20 lines]
> Thanks
> Kate
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.