Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
improve clarity of excel data linked in PowerPoint | Excel Discussion (Misc queries) | |||
Gridlines ok in Excel but linked powerpoint- lines are missing | Charts and Charting in Excel | |||
Linked Excel graphs in PowerPoint | Charts and Charting in Excel | |||
How to spread the area of a linked excel worksheet in PowerPoint | Excel Discussion (Misc queries) | |||
How do I insert an Excel file into a PowerPoint Presentation slid. | Excel Discussion (Misc queries) |