LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert linked chart from excel to powerpoint

hi Mark
I finally found a sort of solution, though if you or anyone out ther
has a simpler one, I'd love to hear. I've picked up on your ideas o
opening excel through pp and also inserting an excel chart.

The code below places linked copies of all the charts in a worksheet o
successive slides in a pp presentation by going through thes
processes:

* opens excel
* deletes all slides
* places an unspecified linked chart from the target excel file file o
slide 1
* for each chart in excel, copies the linked chart onto a new slide
* overwrites the link source for each new chart with a link to th
named chart sheet in excel
* updates the links

clunky, but it does the job

Sub overwrite_link_sources()
Dim Excel_App As Excel.Application
Dim Excel_Book As Excel.Workbook
'source file:
file_fullname = "c:\temp\chart source.xls"

Set Excel_App = Nothing
Set Excel_App = New Excel.Application
Set Excel_Book = Excel_App.Workbooks.Open(file_fullname
UpdateLinks:=False)

'delete all slides, then insert linked chart on new slide 1
ActivePresentation.Slides.Range.Delete
ActivePresentation.Slides.Add(Index:=1, Layout:=ppLayoutBlank).Select
ActiveWindow.Selection.SlideRange.Shapes.AddOLEObj ect(Left:=120#
Top:=110#, Width:=480#, Height:=320#, FileName:=file_fullname
Link:=msoTrue).Select
With ActiveWindow.Selection.ShapeRange
.Left = 8
.Top = 12
.LockAspectRatio = msoFalse
.Height = 520
.Width = 700
.LinkFormat.AutoUpdate = ppUpdateOptionManual
End With

'copy linked chart on slide 1
ActiveWindow.View.GotoSlide Index:=1
ActiveWindow.Selection.SlideRange.Shapes(1).Copy

'add new slides, copy the linked chart from slide 1, then overwrite th
link
For n = 1 To Excel_Book.Charts.Count
ActiveWindow.View.GotoSlid
Index:=ActivePresentation.Slides.Add(Index:=n + 1
Layout:=ppLayoutBlank).SlideIndex
ActiveWindow.View.Paste
fncn = file_fullname & "!" & Excel_Book.Charts(n).Name
ActiveWindow.Selection.SlideRange.Shapes(1).LinkFo rmat.SourceFullName
fncn
'ActiveWindow.Selection.ShapeRange.LinkFormat.Upda te
Next

ActivePresentation.Slides(1).Delete ' delete dummy slide

'update links
For Each sld In ActivePresentation.Slides
For Each sh In sld.Shapes
If sh.Type = msoLinkedOLEObject Then
sh.LinkFormat.Update
End If
Next
Next


Set Excel_Book = Nothing
Set Excel_App = Nothing

End Su

--
Message posted from http://www.ExcelForum.com

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
improve clarity of excel data linked in PowerPoint Jessy Owen Excel Discussion (Misc queries) 1 July 9th 09 12:12 AM
Gridlines ok in Excel but linked powerpoint- lines are missing ZALI Charts and Charting in Excel 1 March 16th 09 03:38 AM
Linked Excel graphs in PowerPoint MAB Charts and Charting in Excel 0 January 10th 07 03:36 PM
How to spread the area of a linked excel worksheet in PowerPoint BB Excel Discussion (Misc queries) 0 September 1st 05 08:49 AM
How do I insert an Excel file into a PowerPoint Presentation slid. Barb Excel Discussion (Misc queries) 1 December 11th 04 04:22 PM


All times are GMT +1. The time now is 08:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"