PDA

View Full Version : For Next loop error



Red2034
10-30-2007, 04:37 PM
Sub Loop()

Dim x As Long
Dim y As Long
Dim i As Integer
Dim objText As Object

For x = 3 To ActivePresentation.Slides.Count
For y = 1 To ActivePresentation.Slides(x).Shapes.Count
For i = 1 To 15

If ActivePresentation.Slides(x).Shapes(y).Type = msoOLEControlObject Then

Set objTxt = ActivePresentation.Slides(x).Shapes(y).OLEFormat.Object

If objTxt.Name = "PageTitle" Then
MsgBox objTxt.Name + " = " + objTxt.Text
End If

Slide115.TOCpagetitle(i).Value = objTxt.Text 'this is where i am getting the error "Method or data member not found" during the second loop thru, am I using the (i) correctlly???? each time thru it shoud add +1 to i (right??)

Set objTxt = Nothing

End If

Next i
Next y
Next x
End Sub

Bob Phillips
10-30-2007, 04:49 PM
Shouldn't this be in the PowerPoint forum?

Red2034
10-30-2007, 04:53 PM
but my question is still about the general nature of VBA

do you know the answer to my question???

Bob Phillips
10-30-2007, 04:56 PM
This isn't a 'General Nature of VBA' forum, it is Excel.