VBA Font Size Issue

G

Guest

To Whom It Concerns:

I am trying to get the text area of a regular slide (Shape 2) to change font
sizes from 32 to 24. I have included the code below. I am able to do it in
one presentation but not in this one. Any advice from anyone would be
greatly appreciated.

Chris

-----Code to create additional slide & add text and buttons-----

Sub PrintablePage()
Dim printableSlide As Slide
Dim homeButton As Shape
Dim printButton As Shape
Dim endButton As Shape
Set printableSlide = ActivePresentation.Slides.Add(Index:=81, _
Layout:=ppLayoutText)
printableSlide.FollowMasterBackground = msoFalse
printableSlide.Shapes(1).TextFrame.TextRange.Text = "Results for " &
username

PowerPoint.ActivePresentation.Slides(81).Shapes(2).TextFrame.TextRange.Font.Size = 24 'This is the latest attempt
'printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 24' This line
works in other presentations but is Remarked while I work on finding the
solution
printableSlide.Shapes(2).TextFrame.AutoSize = ppAutoSizeNone
printableSlide.Shapes(2).TextFrame.TextRange.ParagraphFormat.Bullet.Type
= ppBulletNone
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"You correctly answered " & QCorrect & " out of " & _
intAnswerCnt & "." & Chr$(13) & _
"Your Percentage is " & Format(QCorrect / intAnswerCnt, "00.00%") &
Chr$(13) & _
"It took you " & Format((EndTime - BeginTime) / 60, "00.00") & "
minutes to complete this training." & _
Chr$(13) & "Your Average Time Per Slide was " & Format(AvgSlideTime,
"00.00") & " seconds." & _
Chr$(13) & "Press the Print Results button to print the certificate."
Set homeButton = ActivePresentation.Slides(81).Shapes.AddShape _
(msoShapeActionButtonCustom, 50, 400, 250, 50)
homeButton.TextFrame.TextRange.Text = "Start Again"
homeButton.TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0)
homeButton.TextFrame.TextRange.Font.Size = 25
homeButton.AutoShapeType = msoShapeLeftArrow
homeButton.Fill.PresetTextured msoTextureBlueTissuePaper
homeButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
homeButton.ActionSettings(ppMouseClick).Run = "StartAgain"
Set printButton = ActivePresentation.Slides(81).Shapes.AddShape _
(msoShapeActionButtonCustom, 320, 400, 250, 50)
printButton.TextFrame.TextRange.Text = "Print Results"
printButton.TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0)
printButton.TextFrame.TextRange.Font.Size = 25
printButton.AutoShapeType = msoShapeRightArrow
printButton.Fill.PresetTextured msoTextureBlueTissuePaper
printButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
printButton.ActionSettings(ppMouseClick).Run = "PrintResults"
Set endButton = ActivePresentation.Slides(81).Shapes.AddShape _
(msoShapeActionButtonCustom, 160, 460, 300, 50)
endButton.TextFrame.TextRange.Text = "End Presentation"
endButton.TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0)
endButton.TextFrame.TextRange.Font.Size = 25
endButton.AutoShapeType = msoShapeFlowchartTerminator
endButton.Fill.PresetTextured msoTextureBlueTissuePaper
endButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
endButton.ActionSettings(ppMouseClick).Run = "EndNow"
ActivePresentation.SlideShowWindow.View.Next
ActivePresentation.Saved = True

End Sub
 
G

Guest

Chris,

Hey, that code looks really familiar. I'm not sure why it is not working for
you. One guess is that the text box is autosizing. You could either turn off
the autosizing for the text box, or you could put the code for changing the
size after the code for adding the text to the box, so you'll fix the size
after it tries to autosize.

I would also suggest putting a breakpoint or a MsgBox right after you change
the size to see if it changes the size and then changes it back again.

--David

David M. Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
G

Guest

David,

It should look very familiar to you. You were the one who gave me the code
to do what I needed to do. Of course, I must say your code has caused me
extra work once the managers found out that a "certificate" could be printed
out.

Chris
 
G

Guest

David,

Placing the font size after the text entry worked. Thank you for your
assistance with this issue and all issues in the past and most likely future.

Sincerely,

Chris
 
D

David M. Marcovitz

You're welcome. Glad I could help.
--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/
 

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