D
Dave Jenkins
Let me see if I can explain this without confusing both of us:
I have vba code that creates a textbox. When the textbox is created and the
user begins to enter text, the entire text frame turns white, and the text
color is taken from defaults (I guess -- at any rate, it's certainly not the
color I specify in the code when I create the textbox). If the textbox is
created with some default text in it, the text is displayed (in my test case)
as white on a black background.
As soon as the user quits entering text (by selecting something else, say),
the textframe background/fill reverts to the fill color for the entire
textbox and the text itself changes to the color specified in the code for
text in the shape.
This only happens in PPT 2003 - in 2007 all operations behaves as expected
(or at least as desired) regardless of whether the textbox is created with
defaulted text in it or not.
My question is: in PPT 2003, is there any way to create a textbox with red
fill, say, and specify white text, and have the text appear as white on a red
backgound when the text is being entered?
Here's some code that I've been using. I'm sure that for testing purposes
more of it could be deleted, but I haven't started going through that
exercise yet.
Sub TextboxTest()
Dim tBoxSh As Shape
Dim oTxtRng As TextRange
' Inserts black-bordered text box with red fill, and sets the font as Ariel
Narrow at 12 pt, with white text.
Set tBoxSh =
ActiveWindow.View.Slide.Shapes.AddTextbox(msoTextOrientationHorizontal,
-16.375, 120.75, 240!, 30!)
With tBoxSh
' fill parameters
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Transparency = 0#
' line parameters
.Line.Weight = 2#
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(0, 0, 0)
With .TextFrame
.WordWrap = msoTrue
.AutoSize = ppAutoSizeShapeToFitText
.MarginBottom = 6
.MarginLeft = 6
.MarginRight = 6
.MarginTop = 6
With .TextRange
' here's where I can populate the textbox with soem default stuff
.text = "default text"
With .Font
.name = "Arial Narrow"
.Size = 18
.BaselineOffset = 0
.Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
End With ' .font
End With ' .textrange
End With ' .textframe
End With ' ActiveWindow.Selection.ShapeRange(1)
' this code here in an attempt to create an visible iinsertion bar at the
start of text
Set oTxtRng = tBoxSh.TextFrame.TextRange
oTxtRng.Characters(oTxtRng.Start + oTxtRng.length, 0).Select
Exit Sub
End Sub
I have vba code that creates a textbox. When the textbox is created and the
user begins to enter text, the entire text frame turns white, and the text
color is taken from defaults (I guess -- at any rate, it's certainly not the
color I specify in the code when I create the textbox). If the textbox is
created with some default text in it, the text is displayed (in my test case)
as white on a black background.
As soon as the user quits entering text (by selecting something else, say),
the textframe background/fill reverts to the fill color for the entire
textbox and the text itself changes to the color specified in the code for
text in the shape.
This only happens in PPT 2003 - in 2007 all operations behaves as expected
(or at least as desired) regardless of whether the textbox is created with
defaulted text in it or not.
My question is: in PPT 2003, is there any way to create a textbox with red
fill, say, and specify white text, and have the text appear as white on a red
backgound when the text is being entered?
Here's some code that I've been using. I'm sure that for testing purposes
more of it could be deleted, but I haven't started going through that
exercise yet.
Sub TextboxTest()
Dim tBoxSh As Shape
Dim oTxtRng As TextRange
' Inserts black-bordered text box with red fill, and sets the font as Ariel
Narrow at 12 pt, with white text.
Set tBoxSh =
ActiveWindow.View.Slide.Shapes.AddTextbox(msoTextOrientationHorizontal,
-16.375, 120.75, 240!, 30!)
With tBoxSh
' fill parameters
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Fill.Transparency = 0#
' line parameters
.Line.Weight = 2#
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(0, 0, 0)
With .TextFrame
.WordWrap = msoTrue
.AutoSize = ppAutoSizeShapeToFitText
.MarginBottom = 6
.MarginLeft = 6
.MarginRight = 6
.MarginTop = 6
With .TextRange
' here's where I can populate the textbox with soem default stuff
.text = "default text"
With .Font
.name = "Arial Narrow"
.Size = 18
.BaselineOffset = 0
.Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
End With ' .font
End With ' .textrange
End With ' .textframe
End With ' ActiveWindow.Selection.ShapeRange(1)
' this code here in an attempt to create an visible iinsertion bar at the
start of text
Set oTxtRng = tBoxSh.TextFrame.TextRange
oTxtRng.Characters(oTxtRng.Start + oTxtRng.length, 0).Select
Exit Sub
End Sub