Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Graph object always missed info.

The question is:

i have Excel file updated on daily basis. I need to refresh PowerPoint
presentation file after this because ppt Graph should be also updated.

Here is a peace of code:

SayStatusBar "Loading data from Excel file..."

Set objXlsApp = CreateObject("Excel.Application")
objXlsApp.Visible = True
objXlsApp.DisplayAlerts = False
objXlsApp.Interactive = False
objXlsApp.AskToUpdateLinks = False
objXlsApp.Workbooks.Open TxtXlsSrcFile.Text, ReadOnly:=True
Set objSrcWorkbook =
objXlsApp.Workbooks(GetShortFileName(TxtXlsSrcFile .Text))

SayStatusBar "Creating presentation object..."
' create presentation object
Set objPpt = CreateObject("PowerPoint.Application")
objPpt.Activate

' open old file as template
objPpt.Presentations.Open TxtPptSrcFile.Text ', msoTrue

' save under new name
objPresentation.SaveAs TxtPptDestFile.Text

lngSlideCount = objPresentation.Slides.Count
For i = 1 To lngSlideCount

' here is a source worksheet
Set objSrcSheet = objSrcWorkbook.Worksheets('Sheet1$')
' Graph object
Set objChart = objSlide.Shapes.Item(1).objShape.OLEFormat.Object

With objChart.Application.DataSheet

' copy rows
For i = 0 To (lngXlsRowEnd - lngXlsRowStart)

' copy cols
For j = 0 To (lngXlsColEnd - lngXlsColStart)

.Cells(lngGraphRowStart + i, lngGraphColStart + j).Value
= _
objSrcSheet.Cells(lngXlsRowStart + i, lngXlsColStart
+ j).Value

Next j

Next i

End With

objChart.Refresh

next i

Label1:
objChart.Refresh

SayStatusBar "Saving results..."
objPresentation.Save
set objPresentation = nothing.....
objPpt.Quit
Set objPpt = nothing
...

The problem is: without calling objChart.Refresh i always saw the info
like in old file - no changes (but in debugger i see the differences!).
With using objChart.Refresh i can save file with a new info. But when i
opened a new file after save and "double click" on Chart - new info
disappears and Graph looks like old one (1 second ago it looks like
new!). TBC: If i will make a pause at Label1 (messagebos, for example),
switch to PPT application, make some clicks (no changes) and after that
resume my application - all info saved in the new file and never revert
back.

So where is my mistake and how to correctly update a Chart in PowerPoint
presentation?

Thanks in advance.
Igor



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Graph object always missed info.

I haven't gone through your code but here's one way to address the
issue. Change the PP chart so that it is linked to the XL chart and
not an independent object (or image). Now, PP will update the inserted
(and linked) chart whenever the file is opened as well as when a
slideshow starts.

--
Regards,

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

In article ,
says...
The question is:

i have Excel file updated on daily basis. I need to refresh PowerPoint
presentation file after this because ppt Graph should be also updated.

Here is a peace of code:

SayStatusBar "Loading data from Excel file..."

Set objXlsApp = CreateObject("Excel.Application")
objXlsApp.Visible = True
objXlsApp.DisplayAlerts = False
objXlsApp.Interactive = False
objXlsApp.AskToUpdateLinks = False
objXlsApp.Workbooks.Open TxtXlsSrcFile.Text, ReadOnly:=True
Set objSrcWorkbook =
objXlsApp.Workbooks(GetShortFileName(TxtXlsSrcFile .Text))

SayStatusBar "Creating presentation object..."
' create presentation object
Set objPpt = CreateObject("PowerPoint.Application")
objPpt.Activate

' open old file as template
objPpt.Presentations.Open TxtPptSrcFile.Text ', msoTrue

' save under new name
objPresentation.SaveAs TxtPptDestFile.Text

lngSlideCount = objPresentation.Slides.Count
For i = 1 To lngSlideCount

' here is a source worksheet
Set objSrcSheet = objSrcWorkbook.Worksheets('Sheet1$')
' Graph object
Set objChart = objSlide.Shapes.Item(1).objShape.OLEFormat.Object

With objChart.Application.DataSheet

' copy rows
For i = 0 To (lngXlsRowEnd - lngXlsRowStart)

' copy cols
For j = 0 To (lngXlsColEnd - lngXlsColStart)

.Cells(lngGraphRowStart + i, lngGraphColStart + j).Value
= _
objSrcSheet.Cells(lngXlsRowStart + i, lngXlsColStart
+ j).Value

Next j

Next i

End With

objChart.Refresh

next i

Label1:
objChart.Refresh

SayStatusBar "Saving results..."
objPresentation.Save
set objPresentation = nothing.....
objPpt.Quit
Set objPpt = nothing
..

The problem is: without calling objChart.Refresh i always saw the info
like in old file - no changes (but in debugger i see the differences!).
With using objChart.Refresh i can save file with a new info. But when i
opened a new file after save and "double click" on Chart - new info
disappears and Graph looks like old one (1 second ago it looks like
new!). TBC: If i will make a pause at Label1 (messagebos, for example),
switch to PPT application, make some clicks (no changes) and after that
resume my application - all info saved in the new file and never revert
back.

So where is my mistake and how to correctly update a Chart in PowerPoint
presentation?

Thanks in advance.
Igor



*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Graph object always missed info.

The chart was created manually in PowerPoint. The reason is linked chart
from Excel looks bad.

Is there exist a way to update a chart in PP? I am interesting on idea
or implementation on vb/c#/c++?

I haven't gone through your code but here's one way to
address the
issue. Change the PP chart so that it is linked to
the XL chart and
not an independent object (or image). Now, PP will update
the inserted
(and linked) chart whenever the file is opened as well as
when a
slideshow starts.


--
Regards,

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



The question is:

i have Excel file updated on daily basis. I need to refresh PowerPoint
presentation file after this because ppt Graph should be also updated.

Here is a peace of code:

SayStatusBar "Loading data from Excel file..."

Set objXlsApp = CreateObject("Excel.Application")
objXlsApp.Visible = True
objXlsApp.DisplayAlerts = False
objXlsApp.Interactive = False
objXlsApp.AskToUpdateLinks = False
objXlsApp.Workbooks.Open TxtXlsSrcFile.Text, ReadOnly:=True
Set objSrcWorkbook =
objXlsApp.Workbooks(GetShortFileName(TxtXlsSrcFile .Text))

SayStatusBar "Creating presentation object..."
' create presentation object
Set objPpt = CreateObject("PowerPoint.Application")
objPpt.Activate

' open old file as template
objPpt.Presentations.Open TxtPptSrcFile.Text ', msoTrue

' save under new name
objPresentation.SaveAs TxtPptDestFile.Text

lngSlideCount = objPresentation.Slides.Count
For i = 1 To lngSlideCount

' here is a source worksheet
Set objSrcSheet = objSrcWorkbook.Worksheets('Sheet1$')
' Graph object
Set objChart = objSlide.Shapes.Item(1).objShape.OLEFormat.Object

With objChart.Application.DataSheet

' copy rows
For i = 0 To (lngXlsRowEnd - lngXlsRowStart)

' copy cols
For j = 0 To (lngXlsColEnd - lngXlsColStart)

.Cells(lngGraphRowStart + i, lngGraphColStart + j).Value
= _
objSrcSheet.Cells(lngXlsRowStart + i, lngXlsColStart
+ j).Value

Next j

Next i

End With

objChart.Refresh

next i

Label1:
objChart.Refresh

SayStatusBar "Saving results..."
objPresentation.Save
set objPresentation = nothing.....
objPpt.Quit
Set objPpt = nothing
..

The problem is: without calling objChart.Refresh i always saw the info
like in old file - no changes (but in debugger i see the

differences!).
With using objChart.Refresh i can save file with a new info. But when

i
opened a new file after save and "double click" on Chart - new info
disappears and Graph looks like old one (1 second ago it looks like
new!). TBC: If i will make a pause at Label1 (messagebos, for

example),
switch to PPT application, make some clicks (no changes) and after

that
resume my application - all info saved in the new file and never

revert
back.

So where is my mistake and how to correctly update a Chart in

PowerPoint
presentation?

Thanks in advance.
Igor





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Graph object always missed info.

If the chart was created directly in PP, it is probably a MSGraph chart,
though it might still be an XL chart. In either case, you will have to
use <object identifier.OLEFormat.object.object to get to the chart.
Then, you will be able to use the same kind of constructs you would use
with an XL chart. TO get that syntax, turn on the macro recorder in XL
(Tools | Macro Record new macro...), do whatever it is you want, and
turn off the recorder. In most cases, XL will generate the necessary
code that you can subsequently generalize and fine-tune.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2004

In article , says...
The chart was created manually in PowerPoint. The reason is linked chart
from Excel looks bad.

Is there exist a way to update a chart in PP? I am interesting on idea
or implementation on vb/c#/c++?

I haven't gone through your code but here's one way to
address the
issue. Change the PP chart so that it is linked to
the XL chart and
not an independent object (or image). Now, PP will update
the inserted
(and linked) chart whenever the file is opened as well as
when a
slideshow starts.


--
Regards,

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



The question is:

i have Excel file updated on daily basis. I need to refresh PowerPoint
presentation file after this because ppt Graph should be also updated.

Here is a peace of code:

SayStatusBar "Loading data from Excel file..."

Set objXlsApp = CreateObject("Excel.Application")
objXlsApp.Visible = True
objXlsApp.DisplayAlerts = False
objXlsApp.Interactive = False
objXlsApp.AskToUpdateLinks = False
objXlsApp.Workbooks.Open TxtXlsSrcFile.Text, ReadOnly:=True
Set objSrcWorkbook =
objXlsApp.Workbooks(GetShortFileName(TxtXlsSrcFile .Text))

SayStatusBar "Creating presentation object..."
' create presentation object
Set objPpt = CreateObject("PowerPoint.Application")
objPpt.Activate

' open old file as template
objPpt.Presentations.Open TxtPptSrcFile.Text ', msoTrue

Reply
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
How do I enter in a missed line of info into Excell? JeanMarie Excel Discussion (Misc queries) 1 October 11th 09 05:14 AM
How to change the name of the object Graph 1 in Excel ? rir Charts and Charting in Excel 4 November 9th 07 09:27 AM
Control Bar Width with Graph Object Mike C Charts and Charting in Excel 1 January 17th 07 04:41 AM
Creating a Graph as an Object : Urgent! Richard1284[_5_] Excel Programming 4 May 25th 04 11:33 AM
Creating a Graph as an Object : Urgent! Richard1284[_7_] Excel Programming 0 May 25th 04 11:13 AM


All times are GMT +1. The time now is 07:39 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"