PPT+VBA
슬라이드 노트가 있는 슬라이드만 출력하기
쵸코난
2024. 5. 28. 10:46
관련: 지식인
중요한 슬라이드마다 슬라이드 노트를 작성해 놓았을 때
발표 준비를 위해서 노트가 작성된 슬라이드만 모아서 출력하고 싶은 경우입니다.
매크로를 실행해서 슬라이드 노트가 없는 4, 7 슬라이드 등은 숨김처리해서
인쇄할 때숨겨진 슬라이드를 제외하고 인쇄하면
슬라이드 노트가 있는 슬라이드만 출력하거나 슬라이드 노트 페이지(슬라이드와 슬라이드 노트)를 출력할 수 있습니다.

그 다음 파일 > 인쇄에서 nPDF 등의 가상 PDF 프린터로 인쇄할 때 한 페이지에 2, 4, 6 페이지 인쇄 등을 이용해서 인쇄하면

아래처럼 슬라이드 노트가 있는 슬라이드만 A4한장에 2슬라이드씩 혹은 4슬라이드씩 출력되게 할 수 있습니다.


VBA코드:
Alt+F11 창에서 삽입 > 모듈 추가한 후 아래 코드를 붙여 넣고 F5키로 실행합니다.
'슬라이드 노트를 텍스트파일로 저장하려면 True로 설정
Const SaveNotes2Text As Boolean = True
Sub HideSlidesWithoutNotes()
Dim sld As Slide
Dim shp As Shape
Dim h As Integer, target As String
Dim Found As Boolean
If SaveNotes2Text Then
h = FreeFile
target = ActivePresentation.FullName & ".txt"
Open target For Output As h
End If
For Each sld In ActivePresentation.Slides
Found = False
For Each shp In sld.NotesPage.Shapes
If shp.PlaceholderFormat.Type = ppPlaceholderBody Then
nt = shp.TextFrame.TextRange
'슬라이드 노트가 있으면
If Len(nt) > 0 Then
'Debug.Print sld.SlideIndex, nt
Found = True
sld.SlideShowTransition.Hidden = msoFalse
If SaveNotes2Text Then
Print #h, "#" & sld.SlideIndex
Print #h, nt
End If
End If
End If
Next shp
'슬라이드 노트가 없으면 슬라이드 숨김처리
If Not Found Then sld.SlideShowTransition.Hidden = msoTrue
Next sld
If SaveNotes2Text Then Close h
With ActivePresentation.PrintOptions
.PrintHiddenSlides = msoFalse '숨겨진 슬라이드 인쇄 안함 설정
.OutputType = ppPrintOutputNotesPages '슬라이드 노트 인쇄
.FitToPage = msoTrue
End With
End Sub
또한 슬라이드 노트 내용을 아래처럼 텍스트 파일로 따로 저장할 수도 있습니다.
코드 상단의 Const SaveNotes2Text As Boolean = False 에서 False를 True로 설정하세요.

✅ 매크로가 포함된 샘플 파일 다운로드: