View Single Post
  #4   Report Post  
Hari Prasadh
 
Posts: n/a
Default

Hi Tushar,

Im coding in Excel and transferring data to PPT.

When I update Excel worksheets or MS graph applets using code I have no
problem regarding objects getting resized/repositioned arbitrarily.

But in case of charts the objects get distorted.

Please note I have to use code to automate new data pasting as I have a
template which am using to create lots (really lots) of different PPT
reports only by changing the source data to be pasted. That is why I cannot
use paste link method for the same.

Please guide me as to how I can avoid shrinking of charts

Thanks a lot,
Hari
India


"Tushar Mehta" wrote in message
om...
In the decade or two that I've been using XL and PP I cannot recall a
single instance where I needed to use code to update the PP copy of an
XL chart -- unless, of course, the update has to happen during a
slideshow. Just copy the chart in XL, and in PP use Edit | Paste
Special... | check the 'paste link' (or 'maintain link' or whatever it
is called) option.

If you must use code, search the google.com archives of the PP
newsgroup. I have posted code on a few occassions on how to update a
XL chart / range shown in a PP file while a slideshow is running. Of
course, I am sure others, such as Steve Rindsberg and Shyam Pillai,
must have done the same and/or have examples on their respective
websites.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
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