Macro runs in PowerPoint but not in SlideShow View - Help please

G

Guest

I am trying to create a presentation with multiple buttons that will show
different data point on a map when selected. The macro I created works fine
in PPT but not in Slideshow View. After reviewing additional posts with this
issue I understand why it doesn't work (selection in code which can't be done
in slide show view) but I don't understand how to fix it. Below is simply
code I created by recoding a macro,(I am by no means a programmer) that
creates a text box with a number in it. That's it. Thanks

Sub number()
'
' Macro recorded 7/10/2007 by Melissa
'


ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizontal, 162, 78, 54, 28.875).Select
ActiveWindow.Selection.ShapeRange.TextFrame.WordWrap = msoTrue
With ActiveWindow.Selection.TextRange.ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.5
.LineRuleAfter = msoTrue
.SpaceAfter = 0
End With

ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1,
Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = "1"
With .Font
.Name = "Arial"
.Size = 18
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With
End With
End Sub
 
D

David M. Marcovitz

Don't you know that if you post the code you have it makes it too easy?
Give us a challenge. Make us read your mind. Ok. Just kidding. Thanks for
posting what you have. This should fix your problem:

Sub GoodNumber()
Dim myTextBox As Shape

Set myTextBox = _
ActivePresentation.SlideShowWindow.View.Slide.Shapes _
.AddTextbox(msoTextOrientationHorizontal, 162, 78, 54, 28.875)
myTextBox.TextFrame.WordWrap = msoTrue
With myTextBox.TextFrame.TextRange.ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.5
.LineRuleAfter = msoTrue
.SpaceAfter = 0
End With
With myTextBox.TextFrame.TextRange
.Text = "1"
With .Font
.Name = "Arial"
.Size = 18
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With

End With
End Sub



--
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/
 
G

Guest

I figured if I was going to recieve help I had to make my query as easy as
possible to understand. And it works!!!

Thank you so much!
 

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