这将使您开始,将其保存为PPTM,然后将副本保存为加载项:
ChangeAnswersSlideState
-是否将ActiveSlide更改为答案幻灯片
PrintStudentHandout
-隐藏答案幻灯片,然后打印,然后取消隐藏
Option Explicit
Private Const ANS_ID As String = "ANS"
Sub PrintStudentHandout()
ChangeAnswersSlideVisible
With ActivePresentation
.PrintOptions.ActivePrinter = "Microsoft XPS Document Writer"
.PrintOut
End With
ChangeAnswersSlideVisible msoFalse
End Sub
Private Sub ChangeAnswersSlideVisible(Optional Hide As MsoTriState = msoTrue)
Dim oSlide As Slide, oShp As Shape
For Each oSlide In ActivePresentation.Slides
For Each oShp In oSlide.Shapes
If IsAnswersShape(oShp) Then
oSlide.SlideShowTransition.Hidden = Hide
Exit For
End If
Next oShp
Next oSlide
End Sub
Sub ChangeAnswersSlideState()
Dim oShp As Shape, bChanged As Boolean
bChanged = False
For Each oShp In Application.ActiveWindow.View.Slide.Shapes
If IsAnswersShape(oShp) Then
oShp.Delete
bChanged = True
End If
Next oShp
If Not bChanged Then MakeAnswersSlide
End Sub
Private Sub MakeAnswersSlide(Optional ByRef AnswerSlide As Slide = Nothing)
If AnswerSlide Is Nothing Then Set AnswerSlide = Application.ActiveWindow.View.Slide
With AnswerSlide.Shapes.AddShape(msoShapeOval, -80, 460, 72, 72)
.TextFrame.TextRange.Text = ANS_ID
End With
End Sub
Private Function IsAnswersShape(ByRef CheckShape As Shape) As Boolean
Dim bIsAnAnswerShape As Boolean
bIsAnAnswerShape = False
With CheckShape
If .AutoShapeType = msoShapeOval Then
If .HasTextFrame Then
If .TextFrame.TextRange.Text = ANS_ID Then
bIsAnAnswerShape = True
End If
End If
End If
End With
IsAnswersShape = bIsAnAnswerShape
End Function