VBA changing background on a new slide created by VBA

I

IdaK

Through VBA I've created a slide to print the results of a test. The
background on the rest of the slide is fairly colorful and when I create the
new slide it automatically uses this same background. I would like to change
it to a simple solid white or light colored background. I've tried several
attempts but with no avail. I have the same problem with not being able to
change out the background on the automatic Title box and Text box that are a
part of the layout. I can change everything about the text inside the boxes
but can't recolor the slide or the text boxes. Any ideas?

Here is the code I've tried so far.

Sub PrintablePage()
Dim printableSlide As Slide
Dim homeButton As Shape
Dim printButton As Shape
Dim needtopay As String

Set printableSlide =
ActivePresentation.Slides.Add(Index:=printableSlideNum, _
Layout:=ppLayoutText)
' change background color
With printableSlide
.Design.SlideMaster.Background.Fill.ForeColor.RGB = vbWhite
.Design.SlideMaster.Background.Fill.BackColor.RGB = vbWhite
.Master.Background.Fill.ForeColor.RGB = vbWhite
.Master.Background.Fill.BackColor.RGB = vbWhite
.Background.Fill.BackColor.RGB = vbWhite
.Background.Fill.ForeColor.RGB = vbWhite
End With

printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Results for " & strFirst & " " & strLast
With printableSlide.Shapes(1)
.Fill.ForeColor.RGB = vbWhite
.Fill.BackColor.RGB = vbWhite
.Line.BackColor.RGB = vbYellow
.Line.ForeColor.RGB = vbGreen
.TextFrame.TextRange.Font.Color.RGB = vbBlack
.TextFrame.TextRange.Font.Italic = False
.TextFrame.TextRange.Font.Size = 16
End With
 
S

Steve Rindsberg

Try it with the modification below:

With printableSlide
' add these two lines:
.FollowMasterBackground = msoFalse
.DisplayMasterShapes = msoFalse
'
.Design.SlideMaster.Background.Fill.ForeColor.RGB = vbWhite
.Design.SlideMaster.Background.Fill.BackColor.RGB = vbWhite
.Master.Background.Fill.ForeColor.RGB = vbWhite
.Master.Background.Fill.BackColor.RGB = vbWhite
.Background.Fill.BackColor.RGB = vbWhite
.Background.Fill.ForeColor.RGB = vbWhite
End With
 
I

IdaK

Thanks for the ideas Steve. I tried the two lines but it didn't change my
background. Any more ideas?
 
S

Steve Rindsberg

Thanks for the ideas Steve. I tried the two lines but it didn't change my
background. Any more ideas?

Post the code you have (copy/paste into the message); I'll try it here to see
what I get.
 

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