Add to this macro

A

Annette

Another user provided this code for creating a text box with font size
8/Arial. However, it is putting in color and a border. Since the recorder
was removed, I can not figure out how to add in no color and outline of text
box in addition, I want the text color black.

I monkeyed with this a bit to get the size correct:

Sub RefTextBox()

Dim myBox As Shape
Set myBox = ActivePresentation.Slides(1).Shapes.AddShape(msoShapeRectangle,
10, 10, 211, 15)
myBox.TextFrame.TextRange.Text = "hello" 'put hello in the box
myBox.TextFrame.TextRange.Font.Size = 8 'make the font size of the box 8

End Sub

Thanks for help you provide.
 
D

David Marcovitz

Sub RefTextBox()

Dim myBox As Shape
Set myBox = ActivePresentation.Slides(1).Shapes.AddShape(msoShapeRectangle,
10, 10, 211, 15)
myBox.TextFrame.TextRange.Text = "hello" 'put hello in the box
myBox.TextFrame.TextRange.Font.Size = 8 'make the font size of the box 8

End Sub

Perhaps adding these two lines:

myBox.Fill.Transparency = 1
myBox.Line.Transparency = 1


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

Annette

Worked great and I even figured out how to add, make my text black in color
without further assistance!

Thanks again!
 
J

John Wilson

Just a point your code is adding a rectangle shape not a textbox which is why
you have a fill and line. Probably (depends on the default set) a textbox
would not show the fill / line.

Sub addtxt()
Dim mytxtbox As Shape
Set mytxtbox = ActivePresentation.Slides(1).Shapes.AddTextbox _
(msoTextOrientationHorizontal, 10, 10, 211, 15)
With mytxtbox.TextFrame.TextRange
..Text = "Hello"
..Font.Size = 8
End With
End Sub
 
D

David Marcovitz

That's great! And the second part is even better (that you were able to
figure out more on your own). Next thing you know you'll be answering
other people's questions here.
--David

Worked great and I even figured out how to add, make my text black in color
without further assistance!

Thanks again!


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top