T
trueborn.ankalime
I've put together a PowerPoint presentation quiz, based on the
eminently useful examples generously provided by David Marcovitz...
but I think I've broken it with my VBA noobness.
It's supposed to go through the slides in show mode, give the quiz,
calculate the score and allow the person to print a certificate at the
end. And it works great... for me, on my computer. It works great for
another co-worker of mine, on his computer. But two other co-workers
get a dialog box after they click the button to print their
certificate that asks them if they want to save changes.
What's REALLY funny is that this presentation is part one of a two
part training. Part two works fine, for everyone. And the code is
exactly the same except for slide numbers.
The file is accessed from a file server, so it is not saved locally to
the user's hard drive, if that makes a difference.
What did I do wrong?
Sub PrintablePage()
Dim printableSlide As Slide
Dim backgroundImage As Shape
Dim restartButton As Shape
Dim printButton As Shape
Dim exitButton As Shape
Set printableSlide = _
ActivePresentation.Slides.Add(Index:=printableSlideNum, _
Layout:=ppLayoutText)
If numCorrect > 6 Then
With ActivePresentation
.Slides(printableSlideNum).Design = .Designs(3)
End With
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Certificate of Completion"
printableSlide.Shapes(1).TextFrame.TextRange.Font.Size = 28
' If the number of questions in the test changes, change the
number by which numCorrect is divided in the formula below
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"This certifies that" & Chr$(13) & _
firstlastName & Chr$(13) & _
"successfully completed " & Chr$(13) & _
"Quality Management System Training" & Chr$(13) & _
"Part 1 - The Quality Management" & Chr$(13) & _
"System Requirements"
printableSlide.Shapes(2).TextFrame.TextRange.Lines(2,
1).Font.Bold = msoTrue
printableSlide.Shapes
(2).TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignCenter
printableSlide.Shapes
(2).TextFrame.TextRange.ParagraphFormat.Bullet = msoFalse
printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 24
ActivePresentation.PrintOut From:=printableSlideNum, _
To:=printableSlideNum
MsgBox ("Your certificate is printing. The training module
will now close.")
ActivePresentation.Slides(printableSlideNum).Delete
ActivePresentation.Saved = True
ActivePresentation.Close
Application.Quit
End If
End Sub
eminently useful examples generously provided by David Marcovitz...
but I think I've broken it with my VBA noobness.
It's supposed to go through the slides in show mode, give the quiz,
calculate the score and allow the person to print a certificate at the
end. And it works great... for me, on my computer. It works great for
another co-worker of mine, on his computer. But two other co-workers
get a dialog box after they click the button to print their
certificate that asks them if they want to save changes.
What's REALLY funny is that this presentation is part one of a two
part training. Part two works fine, for everyone. And the code is
exactly the same except for slide numbers.
The file is accessed from a file server, so it is not saved locally to
the user's hard drive, if that makes a difference.
What did I do wrong?
Sub PrintablePage()
Dim printableSlide As Slide
Dim backgroundImage As Shape
Dim restartButton As Shape
Dim printButton As Shape
Dim exitButton As Shape
Set printableSlide = _
ActivePresentation.Slides.Add(Index:=printableSlideNum, _
Layout:=ppLayoutText)
If numCorrect > 6 Then
With ActivePresentation
.Slides(printableSlideNum).Design = .Designs(3)
End With
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
"Certificate of Completion"
printableSlide.Shapes(1).TextFrame.TextRange.Font.Size = 28
' If the number of questions in the test changes, change the
number by which numCorrect is divided in the formula below
printableSlide.Shapes(2).TextFrame.TextRange.Text = _
"This certifies that" & Chr$(13) & _
firstlastName & Chr$(13) & _
"successfully completed " & Chr$(13) & _
"Quality Management System Training" & Chr$(13) & _
"Part 1 - The Quality Management" & Chr$(13) & _
"System Requirements"
printableSlide.Shapes(2).TextFrame.TextRange.Lines(2,
1).Font.Bold = msoTrue
printableSlide.Shapes
(2).TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignCenter
printableSlide.Shapes
(2).TextFrame.TextRange.ParagraphFormat.Bullet = msoFalse
printableSlide.Shapes(2).TextFrame.TextRange.Font.Size = 24
ActivePresentation.PrintOut From:=printableSlideNum, _
To:=printableSlideNum
MsgBox ("Your certificate is printing. The training module
will now close.")
ActivePresentation.Slides(printableSlideNum).Delete
ActivePresentation.Saved = True
ActivePresentation.Close
Application.Quit
End If
End Sub