Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Extracting chart title from Embedded Excel Chart in PowerPoint

I have the following snippet of code in function "FindGraphObjectTitle"

Function FindGraphObjectTitle(myShape As Shape) As String

Dim myOLEFormat As OLEFormat
Dim myGraphObject As Object
Dim myExcelObject As Excel.ChartObject

Set myOLEFormat = myShape.OLEFormat

FindGraphObjectTitle = "N/A"

If myOLEFormat.ProgID Like "MSGraph*" Then
FindGraphObjectTitle = "No MSGraph Title"
Set myGraphObject = myOLEFormat.Object
With myGraphObject
If .HasTitle Then
FindGraphObjectTitle = myGraphObject.ChartTitle.Text
End If
End With
ElseIf myOLEFormat.ProgID Like "Excel*" Then
FindGraphObjectTitle = "No Excel Title"

'Need your help here
End With

End If
End Function

I have no idea what to do with this. I can't seem to figure out the code
to get to the Excel chart . I know the code within excel to get the title,
but the OLEObject piece has me stumped.

Thanks,
Barb Reinhardt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Extracting chart title from Embedded Excel Chart in PowerPoint

Hi,

This assumes no other workbooks are already open in the excel application.
If there are other workbooks open you will need to loop through the
Workbooks collection and identify the one within you presentation,

Function FindGraphObjectTitle(myShape As Shape) As String

Dim myOLEFormat As OLEFormat
Dim myGraphObject As Object
Dim myExcelObject As Excel.ChartObject

Set myOLEFormat = myShape.OLEFormat

FindGraphObjectTitle = "N/A"

If myOLEFormat.ProgID Like "MSGraph*" Then
FindGraphObjectTitle = "No MSGraph Title"
Set myGraphObject = myOLEFormat.Object
With myGraphObject
If .HasTitle Then
FindGraphObjectTitle = myGraphObject.ChartTitle.Text
End If
End With
ElseIf myOLEFormat.ProgID Like "Excel*" Then
FindGraphObjectTitle = "No Excel Title"
With myOLEFormat.Object.Application.Workbooks(1).Charts (1)
If .HasTitle Then
FindGraphObjectTitle = .ChartTitle.Text
End If
End With
End If
End Function

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Barb Reinhardt" wrote in message
...
I have the following snippet of code in function "FindGraphObjectTitle"

Function FindGraphObjectTitle(myShape As Shape) As String

Dim myOLEFormat As OLEFormat
Dim myGraphObject As Object
Dim myExcelObject As Excel.ChartObject

Set myOLEFormat = myShape.OLEFormat

FindGraphObjectTitle = "N/A"

If myOLEFormat.ProgID Like "MSGraph*" Then
FindGraphObjectTitle = "No MSGraph Title"
Set myGraphObject = myOLEFormat.Object
With myGraphObject
If .HasTitle Then
FindGraphObjectTitle = myGraphObject.ChartTitle.Text
End If
End With
ElseIf myOLEFormat.ProgID Like "Excel*" Then
FindGraphObjectTitle = "No Excel Title"

'Need your help here
End With

End If
End Function

I have no idea what to do with this. I can't seem to figure out the code
to get to the Excel chart . I know the code within excel to get the
title,
but the OLEObject piece has me stumped.

Thanks,
Barb Reinhardt


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
Extracting Excel.Chart title from Embedded Excel Chart in PowerPoi Barb Reinhardt Excel Programming 1 June 11th 08 01:30 PM
How Change Powerpoint Embedded Chart Values? MVP Wannabe[_2_] Excel Programming 3 June 29th 07 10:08 PM
Problem in updating the Powerpoint Embedded Chart with Excel figur Vinod Charts and Charting in Excel 0 May 4th 07 02:19 PM
Excel chart - how to assign the file name in the chart title? TGreen Charts and Charting in Excel 1 August 16th 05 10:35 AM
Embedded chart along with DATA to powerpoint Hari Prasadh[_2_] Excel Programming 2 February 10th 05 08:54 AM


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