MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Find text in an unselected listbox, then use to format shape in ppt

  Asked By: Jason    Date: Oct 08    Category: MS Office    Views: 1569

I will try to make this easy to follow.

I am trying to go line by line on my userform's listbox, finding only
part of the text I need in each line, and doing if..then statements to
format corresponding shapes in powerpoint.

I got to the point where I can programmatically open Powerpoint and
save as a new file. I just don't understand how to get the text in the
listbox and:

1. Reference the named shape in the slide based on the listbox row's text


2. Format the referenced shape based on that same line in the listbox

The listbox is named lboQueue.

Dim Green As String
Dim Amber As String
Dim Red As String

Green = "Make Line Green"
Amber = "Make Line Amber"
Red = "Make Line Red"

Set pptShape = pptFile.Slides(1).Shapes("Memphis")

If lboQueue = "Memphis." & Green Then
With pptShape
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(0, 204, 0)
End With

ElseIf lboQueue = "Memphis." & Amber & "..." Then
With pptShape
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(255, 153, 0)
End With

ElseIf lboQueue = "Memphis." & Red & "..." Then
With pptShape
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(255, 0, 0)
End With

End If


I have no clue how to search for text in a listbox, so I know the
first line in every If statement is wrong.

Anyone know how to do this?



No Answers Found. Be the First, To Post Answer.