M
Mark
Hi All,
I have been using Dr. David M. Marcovitz chapter 7.9 (Link to his web below)
to generate a certificate via VB. There are a few things I have yet to be
able to get to work. Any help is appreciated (Code below)
1) I would like to change the font’s of the userName in
printableSlide.Shapes(1)
2) I would like to center printableSlide.Shapes(2) and move it down the page
some.
3) I would like to add a boarder around the page, if possible. I have added
images via example he has supplied, but if I add an image representing a
boarder it covers everything else up. Is there a way to have it on the
bottom? Or a better way?
4) I would like to add a 3rd printableSlide.Shapes(3). Doing so now hangs
up PP.
5) I would like to publicly thank Dr. David M. Marcovitz and others for
their time helping others.
Code:
Sub PrintablePage()
Dim printableSlide As Slide
Dim vRight, vWrong, vResults, vTotal
Dim oPicture As Shape
Dim FullPath As String
Dim oSl As Slide
Set printableSlide = _
ActivePresentation.Slides.Add(Index:=printableSlideNum, _
Layout:=ppLayoutText)
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Label Test Program Results For " & userName
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"You got " & numCorrect & " out of " & numCorrect + numIncorrect & "
- " & (numCorrect / (numCorrect + numIncorrect) * 100) & "%"
printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 26
Set printButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 300, 400, 150, 50)
printButton.TextFrame.TextRange.Text = "Print Results"
printButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
printButton.ActionSettings(ppMouseClick).Run = "PrintResults"
ActivePresentation.SlideShowWindow.View.Next
ActivePresentation.Saved = True
FullPath = "C:\My Documents\my Pictures\leftLogo.jpg"
Set oSl = printableSlide
Set oPicture = oSl.Shapes.AddPicture(FileName:=FullPath, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, Top:=200, _
Width:=100, Height:=100)
With oPicture
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With
Set oPicture = Nothing
Set oSl = Nothing
FullPath = "C:\My Documents\my Pictures\RightLogo.jpg"
Set oSl = printableSlide
Set oPicture = oSl.Shapes.AddPicture(FileName:=FullPath, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=550, Top:=400, _
Width:=100, Height:=100)
With oPicture
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With
Set oPicture = Nothing
Set oSl = Nothing
End Sub
http://www.loyola.edu/edudept/PowerfulPowerPoint/Chapter7Examples.html
I have been using Dr. David M. Marcovitz chapter 7.9 (Link to his web below)
to generate a certificate via VB. There are a few things I have yet to be
able to get to work. Any help is appreciated (Code below)
1) I would like to change the font’s of the userName in
printableSlide.Shapes(1)
2) I would like to center printableSlide.Shapes(2) and move it down the page
some.
3) I would like to add a boarder around the page, if possible. I have added
images via example he has supplied, but if I add an image representing a
boarder it covers everything else up. Is there a way to have it on the
bottom? Or a better way?
4) I would like to add a 3rd printableSlide.Shapes(3). Doing so now hangs
up PP.
5) I would like to publicly thank Dr. David M. Marcovitz and others for
their time helping others.
Code:
Sub PrintablePage()
Dim printableSlide As Slide
Dim vRight, vWrong, vResults, vTotal
Dim oPicture As Shape
Dim FullPath As String
Dim oSl As Slide
Set printableSlide = _
ActivePresentation.Slides.Add(Index:=printableSlideNum, _
Layout:=ppLayoutText)
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Label Test Program Results For " & userName
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"You got " & numCorrect & " out of " & numCorrect + numIncorrect & "
- " & (numCorrect / (numCorrect + numIncorrect) * 100) & "%"
printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 26
Set printButton = _
ActivePresentation.Slides(printableSlideNum).Shapes.AddShape _
(msoShapeActionButtonCustom, 300, 400, 150, 50)
printButton.TextFrame.TextRange.Text = "Print Results"
printButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
printButton.ActionSettings(ppMouseClick).Run = "PrintResults"
ActivePresentation.SlideShowWindow.View.Next
ActivePresentation.Saved = True
FullPath = "C:\My Documents\my Pictures\leftLogo.jpg"
Set oSl = printableSlide
Set oPicture = oSl.Shapes.AddPicture(FileName:=FullPath, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, Top:=200, _
Width:=100, Height:=100)
With oPicture
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With
Set oPicture = Nothing
Set oSl = Nothing
FullPath = "C:\My Documents\my Pictures\RightLogo.jpg"
Set oSl = printableSlide
Set oPicture = oSl.Shapes.AddPicture(FileName:=FullPath, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=550, Top:=400, _
Width:=100, Height:=100)
With oPicture
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With
Set oPicture = Nothing
Set oSl = Nothing
End Sub
http://www.loyola.edu/edudept/PowerfulPowerPoint/Chapter7Examples.html