Share via


DocumentBase.New 이벤트

새 문서가 만들어질 때 발생합니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word.v4.0.Utilities(Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

구문

‘선언
Public Event New As DocumentEvents2_NewEventHandler
public event DocumentEvents2_NewEventHandler New

설명

이 이벤트는 새 문서가 템플릿에서 만들어지는 경우에만 발생합니다.

예제

다음 코드 예제에서는 새 문서가 만들어질 때 메시지를 표시하는 이벤트 처리기를 만듭니다. 이 예제를 사용하려면 Word 템플릿 프로젝트의 ThisDocument 클래스에서 이 예제를 실행하십시오.

Private Sub DocumentNew()
    AddHandler Me.New, AddressOf ThisDocument_New
End Sub

Private Sub ThisDocument_New()
    MessageBox.Show("The Document.New event has fired.")
End Sub
private void DocumentNew()
{
    this.New += new Microsoft.Office.Interop.Word.
        DocumentEvents2_NewEventHandler(
        ThisDocument_New);
}

void ThisDocument_New()
{
    MessageBox.Show("The Document.New event has fired.");
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DocumentBase 클래스

Microsoft.Office.Tools.Word 네임스페이스