Prev: Understanding Text/Background Colors when Creating New Theme Color
Next: Powerpoint 2007 is Making Me Crazy
From: Wayne on 21 Nov 2009 17:32 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: Bill Dilworth on 22 Nov 2009 03:08 VBA can be picky. Is there a space between the Textbox part and the 19 part of the object name? Bill Dilworth "Wayne" <wawilson40(a)gmail.com> wrote in message news:44022dc8-dbbe-4f0a-9bda-42cc18194a86(a)g27g2000yqn.googlegroups.com... >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: John Wilson john AT technologytrish.co DOT on 22 Nov 2009 03:30 If you have not renamed it the name is probably TextBox19 (no space) I would rename to something more useful in the selection / visibility pane though -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html "Wayne" 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: Steve Rindsberg on 22 Nov 2009 13:13 In article <617C1F1E-4102-4F70-B209-BC41BE437467(a)microsoft.com>, John Wilson wrote: > If you have not renamed it the name is probably TextBox19 (no space) One of us has a weird copy of PPT then, sir. Mine puts spaces between the name and the number. ;-) ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: David Marcovitz on 23 Nov 2009 09:07 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
|
Next
|
Last
Pages: 1 2 3 Prev: Understanding Text/Background Colors when Creating New Theme Color Next: Powerpoint 2007 is Making Me Crazy |