مشاركة عبر


WorkbookBase.Protect أسلوب

حماية مصنف بحيث لا يمكن تعديلها.

مساحة الاسم:  Microsoft.Office.Tools.Excel
التجميع:  Microsoft.Office.Tools.Excel.v4.0.Utilities (في Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

بناء الجملة

'إقرار
Public Sub Protect ( _
    password As Object, _
    structure As Object, _
    windows As Object _
)
public void Protect(
    Object password,
    Object structure,
    Object windows
)

المعلمات

  • password
    النوع: System.Object
    حالة الأحرف كلمة المرور للمصنف.إذا كان ترتيب هو وسيطة هو إلغاء الحذف، يمكنك حماية مصنف دون استخدام كلمة مرور.وإلا، يجب عليك تعيين كلمة المرور إلى إلغاء حماية مصنف.
  • structure
    النوع: System.Object
    trueإلى حماية بنية مصنف (الموضع النسبي للأوراق).القيمة الافتراضية هي false.
  • windows
    النوع: System.Object
    trueيحمي مصنف Windows.إذا كان ترتيب هو وسيطة هو، الإطارات غير محمية.

ملاحظات

استخدم كلمات مرور قوية تجمع بين رسائل الكبيرة و أحرف صغيرة، أرقام، و رموز. قم بكلمات مرور ضعيفة لا بمزج هذه العناصر. على سبيل المثال، "Y6dh! et5" كلمة مرور قوية، ولكن "House27" كلمة مرور ضعيفة. استخدام كلمة مرور يمكنك تذكرها بحيث لم يكن إلى بالكتابة.

المعلمات الإختيارية

ل معلومات تشغيل معلمات اختيارية، راجع يفتقد المتغير و "المعلمات الاختيارية" في حلول Office.

أمثلة

يلي تعليمات برمجية يستخدم المثال Protectأسلوب ليحمي بنية مصنف وإطارات المصنف، ولكن دون تعيين كلمة مرور يحمي. المثال ثم يتحقق من قيم ProtectStructureو ProtectWindowsالخصائص للتحقق من ذلك th هو حماية هو. التعيين

Th هو المثال هو لتخصيص المستوى مستند.

Private Sub ProtectWorkbook()
    Me.Protect(Structure:=True, Windows:=True)

    If Me.ProtectStructure Then
        MsgBox("You cannot add, delete or change the location " & _
            "of sheets in this workbook.")
    End If

    If Me.ProtectWindows Then
        MsgBox("You cannot arrange windows in this workbook.")
    End If
End Sub
private void ProtectWorkbook()
{
    this.Protect(missing, true, true);

    if (this.ProtectStructure)
    {
        MessageBox.Show("You cannot add, delete or change the location " +
            "of sheets in this workbook.");
    }

    if (this.ProtectWindows)
    {
        MessageBox.Show("You cannot arrange windows in this workbook.");
    }
}

أمن NET Framework.

راجع أيضًَا

المرجع

WorkbookBase الفئة

WorkbookBase الأعضاء

Microsoft.Office.Tools.Excel مساحة الاسم