Get Excel Object Value in Powerpoint

  • Thread starter Thread starter Ronster
  • Start date Start date
R

Ronster

I'm looking for a way to get the value of a linked cell in PowerPoint
so I can hide or unhide slides based on its value. If location A1 in
Excel contains "TRUE" and I copy this cell to PowerPoint using the
EDIT - PASTE SPECIAL - PASTE LINK - MICROSOFT EXCEL WORKSHEET
OBJECT then by using VBA what do I have to do to get the value of this
linked object in PowerPoint so decisions can be made on which slides to
hide/unhide? Thanks.
 
You want to use Visual basic for a chart update?

I have found that the more a chart is moved the more links (and paths to the
original information) need to be reestablished. Also, keeping these two (ppt
and source xcl) files together is paramount.

Martin
 
Thanks Martin. I also put this code together and it looks like this
will do the trick.

Sub Get_Excel_Data()

' Simple VBA code executed from PowerPoint that
' opens an Excel spreadsheet and gets data at location A1

Dim objExcel As Object, objSheet As Object, strData As String

' Create Excel Object
Set objExcel = CreateObject("Excel.Application")
' open file
objExcel.Workbooks.Open "c:\Temp\Test.xls"
' make Excel visible through the Application object
objExcel.Application.Visible = True
' go to worksheet 1
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
' get value at A1
strData = Trim(objSheet.Range("A1").Value)
' display value
MsgBox strData
' quit application
objExcel.Quit
' release the object variable
Set objExcel = Nothing

End Sub
 
Don't forget that you can leave Excel hidden, if it is useful

objExcel.Application.Visible = False
 
Back
Top