From: Phil K on
Don't mean to hijack this but I figured the problem is similar:
I've read David's book, looked at other examples and I keep getting the
following

Compile Error ... Method or Data Member not found
And the word Shapes is highlighted in blue
for the following.\:
Private Sub CommandButton1_Click()
ActivePresentation.SlideShowWindow.View.Shapes("Picture4").Visible = False
End Sub

I've placed a space between picture and 4 and still same error.

I'm trying to make the Shape disappear in VBA. Since it is part of an
overall VBA program. I can animate it but I need to do using VBA. I am
using PPT 2003 with Vista

"David Marcovitz" wrote:

> As John and Steve suggested, you might be missing something with the spaces
> and as John suggested, you might try to use the SetObjectName macro (in
> Example 8.7) to give it your own name so you are sure exactly what it is.
> The other problem I could see is if you are really doing all of this on a
> different slide than Slides(5). Perhaps, you are working with a different
> slide.
> --David
>
> --
> David M. Marcovitz
> Author of _Powerful PowerPoint for Educators_
> http://www.PowerfulPowerPoint.com/
> Microsoft PowerPoint MVP
> Associate Professor, Loyola University Maryland
>
> On 11/21/09 5:32 PM, in article
> 44022dc8-dbbe-4f0a-9bda-42cc18194a86(a)g27g2000yqn.googlegroups.com, "Wayne"
> <wawilson40(a)gmail.com> wrote:
>
> > I am new at VBA and trying to use VBA in powerPoint 2007 in a vista os
> > to create a quiz. I am reading a set of question into an array of
> > questions from a file and want to add one question at a time to a text
> > box. I am using the following code:
> > ActivePresentation.Slides(5).Shapes("TextBox
> > 19").TextFrame.TextRange.Text = question(number)
> >
> > but I have been getting the following error:
> >
> > Run-time error '-2147188160 (80048240)':
> >
> > Item TextBox 19 not found in the Shapes collection.
> >
> > But when I check the object code using either the selection and
> > visibility option in powerPoint or the code from example 8 from David
> > Marcovitz
> >
> > Public Sub GetObjectName()
> > If ActiveWindow.Selection.Type = ppSelectionShapes _
> > Or ActiveWindow.Selection.Type = ppSelectionText Then
> > If ActiveWindow.Selection.ShapeRange.Count = 1 Then
> > MsgBox (ActiveWindow.Selection.ShapeRange.Name)
> > Else
> > MsgBox ("You have selected more than one shape.")
> > End If
> > Else
> > MsgBox ("No shapes are selected.")
> > End If
> > End Sub
> >
> > I get that the object name is TextBox 19.
> >
> > Please Help
>
>
> .
>
From: David Marcovitz on
Is the shape a regular AutoShape or a control shape? I think all our answers
were assuming that it was a regular AutoShape, but a control shape would act
differently and explain the problems.
--David

On 11/24/09 10:59 PM, in article
1B845B13-0086-4B7B-8229-23FDC9B45D20(a)microsoft.com, "Phil K"
<PhilK(a)discussions.microsoft.com> wrote:

> Don't mean to hijack this but I figured the problem is similar:
> I've read David's book, looked at other examples and I keep getting the
> following
>
> Compile Error ... Method or Data Member not found
> And the word Shapes is highlighted in blue
> for the following.\:
> Private Sub CommandButton1_Click()
> ActivePresentation.SlideShowWindow.View.Shapes("Picture4").Visible = False
> End Sub
>
> I've placed a space between picture and 4 and still same error.
>
> I'm trying to make the Shape disappear in VBA. Since it is part of an
> overall VBA program. I can animate it but I need to do using VBA. I am
> using PPT 2003 with Vista
>
> "David Marcovitz" wrote:
>
>> As John and Steve suggested, you might be missing something with the spaces
>> and as John suggested, you might try to use the SetObjectName macro (in
>> Example 8.7) to give it your own name so you are sure exactly what it is.
>> The other problem I could see is if you are really doing all of this on a
>> different slide than Slides(5). Perhaps, you are working with a different
>> slide.
>> --David
>>
>> --
>> David M. Marcovitz
>> Author of _Powerful PowerPoint for Educators_
>> http://www.PowerfulPowerPoint.com/
>> Microsoft PowerPoint MVP
>> Associate Professor, Loyola University Maryland
>>
>> On 11/21/09 5:32 PM, in article
>> 44022dc8-dbbe-4f0a-9bda-42cc18194a86(a)g27g2000yqn.googlegroups.com, "Wayne"
>> <wawilson40(a)gmail.com> wrote:
>>
>>> I am new at VBA and trying to use VBA in powerPoint 2007 in a vista os
>>> to create a quiz. I am reading a set of question into an array of
>>> questions from a file and want to add one question at a time to a text
>>> box. I am using the following code:
>>> ActivePresentation.Slides(5).Shapes("TextBox
>>> 19").TextFrame.TextRange.Text = question(number)
>>>
>>> but I have been getting the following error:
>>>
>>> Run-time error '-2147188160 (80048240)':
>>>
>>> Item TextBox 19 not found in the Shapes collection.
>>>
>>> But when I check the object code using either the selection and
>>> visibility option in powerPoint or the code from example 8 from David
>>> Marcovitz
>>>
>>> Public Sub GetObjectName()
>>> If ActiveWindow.Selection.Type = ppSelectionShapes _
>>> Or ActiveWindow.Selection.Type = ppSelectionText Then
>>> If ActiveWindow.Selection.ShapeRange.Count = 1 Then
>>> MsgBox (ActiveWindow.Selection.ShapeRange.Name)
>>> Else
>>> MsgBox ("You have selected more than one shape.")
>>> End If
>>> Else
>>> MsgBox ("No shapes are selected.")
>>> End If
>>> End Sub
>>>
>>> I get that the object name is TextBox 19.
>>>
>>> Please Help
>>
>>
>> .
>>

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland


From: Steve Rindsberg on
In article <1B845B13-0086-4B7B-8229-23FDC9B45D20(a)microsoft.com>, Phil K wrote:
> Don't mean to hijack this but I figured the problem is similar:
> I've read David's book, looked at other examples and I keep getting the
> following
>
> Compile Error ... Method or Data Member not found
> And the word Shapes is highlighted in blue
> for the following.\:
> Private Sub CommandButton1_Click()
> ActivePresentation.SlideShowWindow.View.Shapes("Picture4").Visible = False
> End Sub
>
> I've placed a space between picture and 4 and still same error.

Select the picture in question then run this little macro:

Sub Whoomeye()
With ActiveWindow.Selection.ShapeRange(1)
MsgBox .Name
End With
End Sub

That'll give you the name of the shape. Use whatever it says in place of
"Picture4" above.

>
> I'm trying to make the Shape disappear in VBA. Since it is part of an
> overall VBA program. I can animate it but I need to do using VBA. I am
> using PPT 2003 with Vista
>
> "David Marcovitz" wrote:
>
> > As John and Steve suggested, you might be missing something with the spaces
> > and as John suggested, you might try to use the SetObjectName macro (in
> > Example 8.7) to give it your own name so you are sure exactly what it is.
> > The other problem I could see is if you are really doing all of this on a
> > different slide than Slides(5). Perhaps, you are working with a different
> > slide.
> > --David
> >
> > --
> > David M. Marcovitz
> > Author of _Powerful PowerPoint for Educators_
> > http://www.PowerfulPowerPoint.com/
> > Microsoft PowerPoint MVP
> > Associate Professor, Loyola University Maryland
> >
> > On 11/21/09 5:32 PM, in article
> > 44022dc8-dbbe-4f0a-9bda-42cc18194a86(a)g27g2000yqn.googlegroups.com, "Wayne"
> > <wawilson40(a)gmail.com> wrote:
> >
> > > I am new at VBA and trying to use VBA in powerPoint 2007 in a vista os
> > > to create a quiz. I am reading a set of question into an array of
> > > questions from a file and want to add one question at a time to a text
> > > box. I am using the following code:
> > > ActivePresentation.Slides(5).Shapes("TextBox
> > > 19").TextFrame.TextRange.Text = question(number)
> > >
> > > but I have been getting the following error:
> > >
> > > Run-time error '-2147188160 (80048240)':
> > >
> > > Item TextBox 19 not found in the Shapes collection.
> > >
> > > But when I check the object code using either the selection and
> > > visibility option in powerPoint or the code from example 8 from David
> > > Marcovitz
> > >
> > > Public Sub GetObjectName()
> > > If ActiveWindow.Selection.Type = ppSelectionShapes _
> > > Or ActiveWindow.Selection.Type = ppSelectionText Then
> > > If ActiveWindow.Selection.ShapeRange.Count = 1 Then
> > > MsgBox (ActiveWindow.Selection.ShapeRange.Name)
> > > Else
> > > MsgBox ("You have selected more than one shape.")
> > > End If
> > > Else
> > > MsgBox ("No shapes are selected.")
> > > End If
> > > End Sub
> > >
> > > I get that the object name is TextBox 19.
> > >
> > > Please Help
> >
> >
> > .
> >


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


From: Phil K on
Steve .. The routine gave me Picture 4. I even tried a new rectangular
shape and I got the same error. I tried with or without space between
Picture 4.

David .. Not 100% sure what you mean by Auto shape or control shape. I
created a graphic that I would like to disappear when one clicks on the
command button, and appear when another command button is clicked. I did
select a shape from the AutoShape selections just to try out and i get the
same error.

Thanks for both for helping

"Steve Rindsberg" wrote:

> In article <1B845B13-0086-4B7B-8229-23FDC9B45D20(a)microsoft.com>, Phil K wrote:
> > Don't mean to hijack this but I figured the problem is similar:
> > I've read David's book, looked at other examples and I keep getting the
> > following
> >
> > Compile Error ... Method or Data Member not found
> > And the word Shapes is highlighted in blue
> > for the following.\:
> > Private Sub CommandButton1_Click()
> > ActivePresentation.SlideShowWindow.View.Shapes("Picture4").Visible = False
> > End Sub
> >
> > I've placed a space between picture and 4 and still same error.
>
> Select the picture in question then run this little macro:
>
> Sub Whoomeye()
> With ActiveWindow.Selection.ShapeRange(1)
> MsgBox .Name
> End With
> End Sub
>
> That'll give you the name of the shape. Use whatever it says in place of
> "Picture4" above.
>
> >
> > I'm trying to make the Shape disappear in VBA. Since it is part of an
> > overall VBA program. I can animate it but I need to do using VBA. I am
> > using PPT 2003 with Vista
> >
> > "David Marcovitz" wrote:
> >
> > > As John and Steve suggested, you might be missing something with the spaces
> > > and as John suggested, you might try to use the SetObjectName macro (in
> > > Example 8.7) to give it your own name so you are sure exactly what it is.
> > > The other problem I could see is if you are really doing all of this on a
> > > different slide than Slides(5). Perhaps, you are working with a different
> > > slide.
> > > --David
> > >
> > > --
> > > David M. Marcovitz
> > > Author of _Powerful PowerPoint for Educators_
> > > http://www.PowerfulPowerPoint.com/
> > > Microsoft PowerPoint MVP
> > > Associate Professor, Loyola University Maryland
> > >
> > > On 11/21/09 5:32 PM, in article
> > > 44022dc8-dbbe-4f0a-9bda-42cc18194a86(a)g27g2000yqn.googlegroups.com, "Wayne"
> > > <wawilson40(a)gmail.com> wrote:
> > >
> > > > I am new at VBA and trying to use VBA in powerPoint 2007 in a vista os
> > > > to create a quiz. I am reading a set of question into an array of
> > > > questions from a file and want to add one question at a time to a text
> > > > box. I am using the following code:
> > > > ActivePresentation.Slides(5).Shapes("TextBox
> > > > 19").TextFrame.TextRange.Text = question(number)
> > > >
> > > > but I have been getting the following error:
> > > >
> > > > Run-time error '-2147188160 (80048240)':
> > > >
> > > > Item TextBox 19 not found in the Shapes collection.
> > > >
> > > > But when I check the object code using either the selection and
> > > > visibility option in powerPoint or the code from example 8 from David
> > > > Marcovitz
> > > >
> > > > Public Sub GetObjectName()
> > > > If ActiveWindow.Selection.Type = ppSelectionShapes _
> > > > Or ActiveWindow.Selection.Type = ppSelectionText Then
> > > > If ActiveWindow.Selection.ShapeRange.Count = 1 Then
> > > > MsgBox (ActiveWindow.Selection.ShapeRange.Name)
> > > > Else
> > > > MsgBox ("You have selected more than one shape.")
> > > > End If
> > > > Else
> > > > MsgBox ("No shapes are selected.")
> > > > End If
> > > > End Sub
> > > >
> > > > I get that the object name is TextBox 19.
> > > >
> > > > Please Help
> > >
> > >
> > > .
> > >
>
>
> ==============================
> PPT Frequently Asked Questions
> http://www.pptfaq.com/
>
> PPTools add-ins for PowerPoint
> http://www.pptools.com/
>
>
> .
>
From: Steve Rindsberg on
In article <AD2373E5-ED3E-418D-B2E3-A62E8FBE0FE8(a)microsoft.com>, Phil K wrote:
> Steve .. The routine gave me Picture 4. I even tried a new rectangular
> shape and I got the same error. I tried with or without space between
> Picture 4.
>
> David .. Not 100% sure what you mean by Auto shape or control shape. I
> created a graphic that I would like to disappear when one clicks on the
> command button, and appear when another command button is clicked. I did
> select a shape from the AutoShape selections just to try out and i get the
> same error.

OK, let's try this to answer David's question:

Sub Whatmeye()
With ActiveWindow.Selection.ShapeRange(1)
MsgBox .Type
End With
End Sub

That'll give you the type of object this is. Let us know what you find out.

> >
> > That'll give you the name of the shape. Use whatever it says in place of
> > "Picture4" above.
> >
> > >
> > > I'm trying to make the Shape disappear in VBA. Since it is part of an
> > > overall VBA program. I can animate it but I need to do using VBA. I am
> > > using PPT 2003 with Vista
> > >
> > > "David Marcovitz" wrote:
> > >
> > > > As John and Steve suggested, you might be missing something with the spaces
> > > > and as John suggested, you might try to use the SetObjectName macro (in
> > > > Example 8.7) to give it your own name so you are sure exactly what it is.
> > > > The other problem I could see is if you are really doing all of this on a
> > > > different slide than Slides(5). Perhaps, you are working with a different
> > > > slide.
> > > > --David
> > > >
> > > > --
> > > > David M. Marcovitz
> > > > Author of _Powerful PowerPoint for Educators_
> > > > http://www.PowerfulPowerPoint.com/
> > > > Microsoft PowerPoint MVP
> > > > Associate Professor, Loyola University Maryland
> > > >
> > > > On 11/21/09 5:32 PM, in article
> > > > 44022dc8-dbbe-4f0a-9bda-42cc18194a86(a)g27g2000yqn.googlegroups.com, "Wayne"
> > > > <wawilson40(a)gmail.com> wrote:
> > > >
> > > > > I am new at VBA and trying to use VBA in powerPoint 2007 in a vista os
> > > > > to create a quiz. I am reading a set of question into an array of
> > > > > questions from a file and want to add one question at a time to a text
> > > > > box. I am using the following code:
> > > > > ActivePresentation.Slides(5).Shapes("TextBox
> > > > > 19").TextFrame.TextRange.Text = question(number)
> > > > >
> > > > > but I have been getting the following error:
> > > > >
> > > > > Run-time error '-2147188160 (80048240)':
> > > > >
> > > > > Item TextBox 19 not found in the Shapes collection.
> > > > >
> > > > > But when I check the object code using either the selection and
> > > > > visibility option in powerPoint or the code from example 8 from David
> > > > > Marcovitz
> > > > >
> > > > > Public Sub GetObjectName()
> > > > > If ActiveWindow.Selection.Type = ppSelectionShapes _
> > > > > Or ActiveWindow.Selection.Type = ppSelectionText Then
> > > > > If ActiveWindow.Selection.ShapeRange.Count = 1 Then
> > > > > MsgBox (ActiveWindow.Selection.ShapeRange.Name)
> > > > > Else
> > > > > MsgBox ("You have selected more than one shape.")
> > > > > End If
> > > > > Else
> > > > > MsgBox ("No shapes are selected.")
> > > > > End If
> > > > > End Sub
> > > > >
> > > > > I get that the object name is TextBox 19.
> > > > >
> > > > > Please Help
> > > >
> > > >
> > > > .
> > > >
> >
> >
> > ==============================
> > PPT Frequently Asked Questions
> > http://www.pptfaq.com/
> >
> > PPTools add-ins for PowerPoint
> > http://www.pptools.com/
> >
> >
> > .
> >


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/