LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Hari Prasadh
 
Posts: n/a
Default Updating Excel OLE chart data in PPT from Excel

Hi,

I posted in PPT group but would like to try here as well.

Im trying to automatically update a Excel OLE CHART object Data in a
Powerpoint slide.

The name of the chart object in PPT slide is "NRMAWC023". It has an excel
chartsheet with name "Chart1" and a
worksheet "q20". The chart sheet named "chart1" is the one which gets
displayed in
PPT and the worksheet "q20" contains the data for "chart1". I run the code
at the end of the mail.

The data in the object NRMAWC023 gets updated (presently it has dummy data)
but then the active view in
excel OLE changes from "chart1" to "q20". Also, the whole object gets
RESIZED and REPositioned.

Thus automation defeats the ONE of the main purpose of why I want to
automate, which is to avoid embedded Excel content in PPT from resizing and
repositioning itself. (another reason why am automating is there is a lot
of slides on which this is to be done)

Please tell me what code I should write/include in the exiting code so that
the existing object in PPT doesnt get resized/repositioned and also the
ACTIVE VIEW
remains at "chart1".

Please guide me for the same.

Here is the novice macro for the same.

'below macro run from personal.xls workbook.

Option Explicit
Dim oPPTApp1 As PowerPoint.Application
Dim oPPTShape1 As PowerPoint.Shape
Dim rngNewRange1 As Excel.Range
Dim oExceldata As Object
Dim Excelwksheet As Worksheet

Sub UpdateExcelData()

Set oPPTApp1 = CreateObject("PowerPoint.Application")

oPPTApp1.Visible = msoTrue

With oPPTApp1.ActivePresentation.Slides(1)
For Each oPPTShape1 In .Shapes

If oPPTShape1.Name = "NRMAWC023" Then

Set oExceldata = oPPTShape1.OLEFormat.Object

Set rngNewRange1 = ActiveSheet.Range("A10:ag13")
rngNewRange1.Select
rngNewRange1.Copy

Set Excelwksheet = oExceldata.Worksheets("q20")
Excelwksheet.Range("A9").PasteSpecial xlPasteValues

Next oPPTShape1

End With

End Sub


Thanks a lot,
Hari
India


 
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
I want chart source data to be relative references, not absolute. Bob Mc Charts and Charting in Excel 1 April 7th 06 02:53 PM
Excel 2002 chart does not update when worksheet data changes proquant Charts and Charting in Excel 1 June 15th 05 12:23 AM
Help making a chart that doesn't graph cells without data? Filtration Guy Excel Discussion (Misc queries) 0 March 22nd 05 09:21 PM
Help with data not getting plotted Scott Ehrlich Excel Discussion (Misc queries) 2 January 25th 05 05:17 AM
changing proportion of chart and data table Dawn Parks Charts and Charting in Excel 3 January 6th 05 01:18 AM


All times are GMT +1. The time now is 07:23 AM.

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

About Us

"It's about Microsoft Excel"