다음을 통해 공유


WorksheetBase.Scripts 속성

워크시트를 웹 페이지로 저장할 때 워크시트의 스크립트 또는 코드 블록을 나타내는 Script 개체가 들어 있는 Microsoft.Office.Core.Scripts 컬렉션을 가져옵니다.

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

구문

‘선언
Public ReadOnly Property Scripts As Scripts
    Get
public Scripts Scripts { get; }

속성 값

형식: Microsoft.Office.Core.Scripts
워크시트를 웹 페이지로 저장할 때 워크시트의 스크립트 또는 코드 블록을 나타내는 Script 개체가 들어 있는 Microsoft.Office.Core.Scripts 컬렉션입니다.

예제

다음 코드 예제에서는 Scripts 속성을 사용하여 현재 워크시트의 스크립트 수를 표시하고, 워크시트에 스크립트를 추가한 다음 업데이트된 스크립트 수를 표시합니다.

이 예제는 문서 수준 사용자 지정을 위한 것입니다.

Private Sub AddScript()
    MsgBox("There are " & Me.Scripts.Count & " scripts in this worksheet.")

    Me.Scripts.Add(Me.Range("A1"), _
        Office.MsoScriptLocation.msoScriptLocationInBody, _
        Office.MsoScriptLanguage.msoScriptLanguageVisualBasic, _
        "ScriptOne", String.Empty, "MsgBox ""This is ScriptOne.""")

    MsgBox("There are " & Me.Scripts.Count & " scripts in this worksheet.")
End Sub
private void AddScript()
{
    MessageBox.Show("There are " + this.Scripts.Count +
        " scripts in this worksheet.");

    this.Scripts.Add(this.Range["A1", missing],
        Office.MsoScriptLocation.msoScriptLocationInBody,
        Office.MsoScriptLanguage.msoScriptLanguageVisualBasic,
        "ScriptOne", String.Empty, @"MsgBox ""This is ScriptOne.""");

    MessageBox.Show("There are " + this.Scripts.Count +
        " scripts in this worksheet.");
}

.NET Framework 보안

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

참고 항목

참조

WorksheetBase 클래스

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