Steve;
I have linked values from excel embedded in my slideshows I would like to
insert a bmp based on the value embedded. In excel I was able to do it using
the worksheet_change, but I don't know enough in PowerPoint.
Here is the code I used in Excel, but I would Like to do the same in
PowerPoint:
Two problems, then.
One is retrieving the value from the linked Excel sheet.
You can probably use something very like the code you're already using, but
with some mods to allow you to automate Excel/the linked or embedded data
from PPT. This'll give you a good place to start:
Automate Excel from PowerPoint. Automate PowerPoint from Excel. And so on.
http://www.rdpslides.com/pptfaq/FAQ00368.htm
The other problem is inserting a bitmap once you've worked out the name and
location. This should help with that:
Insert a picture at the correct size
http://www.rdpslides.com/pptfaq/FAQ00329.htm
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$28" Then
Application.EnableEvents = False
HandleBMP
Application.EnableEvents = True
End If
End Sub
Sub HandleBMP()
Dim myCell As Range
Set myCell = Selection
On Error Resume Next
If Range("C28").Value >= 90 Then
MsgBox "Insert Stoplight"
ActiveSheet.Shapes("C28 Picture").Delete
Range("F22").Select
ActiveSheet.Pictures.Insert( _
"C:\grn-lght.bmp").Select
Selection.Name = "C28 Picture"
ElseIf Range("C28").Value >= 78 Then
MsgBox "Insert Stoplight"
ActiveSheet.Shapes("C28 Picture").Delete
Range("F22").Select
ActiveSheet.Pictures.Insert( _
"C:\yellow-lght.bmp").Select
Selection.Name = "C28 Picture"
On Error Resume Next
ElseIf Range("C28").Value < 78 Then
MsgBox "Insert Stoplight"
ActiveSheet.Shapes("C28 Picture").Delete
Range("F22").Select
ActiveSheet.Pictures.Insert( _
"C:\red-lght.bmp").Select
Selection.Name = "C28 Picture"
Else
MsgBox "Deleting"
ActiveSheet.Shapes("C28 Picture").Delete
End If
Else
MsgBox "Deleting"
ActiveSheet.Shapes("C417 Picture").Delete
End If
myCell.Select
End Sub
Thanks for all the help