hunter21188
11-21-2015, 07:40 AM
I have a pre-made powerpoint slide that includes two shapes. The header of the slide (text at the top) is selected via a GUI created with VBA. What I would like is to change the background color of just one of the shapes to a certain color depending on which header has been selected. Is this at all possible?
Here is the code I have that allows the user to select the header:
Private Sub Combo7_DropButtonClick()
If Combo7.ListCount = 0 Then
With Combo7
.AddItem "Generic"
.AddItem "Advisory"
.AddItem "Watch"
.AddItem "Warning"
End With
End If
End Sub
Private Sub Headlines()
'This generates the headline of the slide.
If Combo7 = "Generic" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Generic.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
ElseIf Combo7 = "Advisory" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Advisory.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
ElseIf Combo7 = "Watch" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Watch.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
ElseIf Combo7 = "Warning" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Warning.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
End If
End Sub
So what I need is something along the lines of:
If Combo7 = "Generic" Then
'Here would be the code to change the background color of the shape that is already on the slide, if possible.
Any help is greatly appreciated! Thanks!
Here is the code I have that allows the user to select the header:
Private Sub Combo7_DropButtonClick()
If Combo7.ListCount = 0 Then
With Combo7
.AddItem "Generic"
.AddItem "Advisory"
.AddItem "Watch"
.AddItem "Warning"
End With
End If
End Sub
Private Sub Headlines()
'This generates the headline of the slide.
If Combo7 = "Generic" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Generic.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
ElseIf Combo7 = "Advisory" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Advisory.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
ElseIf Combo7 = "Watch" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Watch.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
ElseIf Combo7 = "Warning" Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _
FileName:="K:\Story\Headline Images\Warning.png", _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, Left:=0, Top:=0, _
Width:=720, Height:=91).Select
End If
End Sub
So what I need is something along the lines of:
If Combo7 = "Generic" Then
'Here would be the code to change the background color of the shape that is already on the slide, if possible.
Any help is greatly appreciated! Thanks!