Trying to save time on macros

D

Derek Wittman

I recorded a macro (and will edit manually) that will change the color of a
text box on my slide. Rather than recording the macro, or editing it, 15
times, is there any way I can create a variable in place of the text box
(object) name?

Sub Macro2()
'
' Macro recorded 2/14/2006 by Derek Wittman
'

ActiveWindow.Selection.SlideRange.Shapes("Text Box 8").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.TextRange.Font.Color.SchemeColor = ppForeground
End Sub

Thank you very much for your help!

DW
 
S

Shyam Pillai

If you delete the following two lines then the macro will change the font
color currently selected textbox.

ActiveWindow.Selection.SlideRange.Shapes("Text Box 8").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
 
D

David M. Marcovitz

I think that if you cut out the first line starting with ActiveWindow,
you should be fine. What you can do is select the text box you want
yourself and then run the macro (without that line), and it should work.
All the first line does is select "Text Box 8" so if you select it
yourself, it should do what you want.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
D

Derek Wittman

Thank you (both of you who replied!) for your help! I really do appreciate it!

DW
 

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