소프트웨어
[Excel VBA] 엑셀 인쇄 차단하기
doubleten
2022. 5. 25. 09:37
엑셀의 인쇄를 제한하기 위해서는 BeforePrint Cancel=True 제한되어야 하는데 잘 작동되지 않는다.
해당 엑셒 파일을 종료하여 인쇄를 차단할 수 있다.
Workbook.BeforePrint event (Excel)
https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.beforeprint
Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim intResponse As Integer
intResponse = MsgBox("이문서는 [대외비]입니다." & Chr(10) _
& Chr(10) & Chr(10) & "인쇄 금지되어 있으며, 인쇄 시도로 파일 종료합니다.", _
vbOKOnly + vbInformation, " YcITeam - [대외비]입니다.")
Cancel = True
ThisWorkbook.Close savechanges:=False
End Sub