I need to create a custom textbox in the active slide with set text, font type, font size, font colour, and bold and italics feature in Powerpoint 2007 using a macro.
I am currently using this code:
Sub InsertTextBox()
Set myDocument = ActivePresentation.Slides(1)
Set newTextBox = myDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, _
100, Top:=100, Width:=541.44, Height:=43.218)
With newTextBox.TextFrame.TextRange
.Text = "Slide Title"
.Font.Size = 24
.Font.Name = "Arial"
.Font.Colour = RGB(107, 107, 107)
End With
End Sub
Its throwing an exception in .Font.Colour saying that this property is not associated with the object. Also i need to incorporate a feature for bold and italics..Plz help me on this
You can use Find on a range to locate a string within a textrange and return a new textrange consisting of just the found text:
In practice, you'd want to use Instr to verify that the text you're looking for is indeed in the text box.