Question

I have the following code:

Sub WriteTextBox()

Dim i As Integer
Dim pptcount As Integer

Dim tb As Shape
Dim sld As Slide
Dim pres As Presentation
Dim var1 As String
var1 = InputBox("Vul hier de maand in")
var2 = "Maand: "
var3 = var2 + var1

pptcount = Application.Presentations.Count

For i = 1 To pptcount
    Set pres = Application.Presentations(i)

    Set sld = pres.Slides(1)

    Set tb = sld.Shapes.AddTextbox(msoTextOrientationHorizontal, 600, 50, 100, 50)
    tb.TextFrame.TextRange.Text = var3
    tb.Line.Visible = True


Next
End Sub

Through which I can place a new text shape into my powerpoint file. I also want to change other stuff in the object (like the font size), but when enter:

tb.TextFrame.TextEffect.FontBold = true

I get an error.

Anybody know how I can add extra features to my text box? Also tried to use With and End With statements but then it does not recognize my object:

With tb.TextFrame.TextRange
    .TextEffect.FontBold = true
End With
Was it helpful?

Solution

tb.TextFrame has no TextEffect property . Try this instead:

tb.TextEffect.FontBold = msoTrue

EDIT Above works in PowerPoint 2010.

The following is for PowerPoint 2003:

tb.TextFrame.TextRange.Font.Bold = msoTrue 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top