VBA Projesinin Korunup Korunmadığını Bul

Python’da VBA Projesinin Korunduğunu Öğrenin

Aspose.Cells for Python via .NET kullanarak Excel dosyanızın VBA (Visual Basic Applications) Projesinin korunup korunmadığını VbaProject.is_protected özelliği ile öğrenebilirsiniz.

Örnek Kod

Aşağıdaki örnek kod bir çalışma kitabı oluşturur ve ardından VBA projesinin korunup korunmadığını kontrol eder. Daha sonra VBA projesini korur ve tekrar korunup korunmadığını kontrol eder. Bir referans için konsol çıktısına bakınız. Koruma öncesi VbaProject.is_protected false döndürürken, koruma sonrası true döndürür.

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Create a workbook.
wb = Workbook()
# Access the VBA project of the workbook.
vbaProj = wb.vba_project
# Find out if VBA Project is Protected using IsProtected property.
print("IsProtected - Before Protecting VBA Project: " + str(vbaProj.is_protected))
# Protect the VBA project.
vbaProj.protect(True, "11")
# Find out if VBA Project is Protected using IsProtected property.
print("IsProtected - After Protecting VBA Project: " + str(vbaProj.is_protected))

Konsol Çıktısı

Yukarıdaki örnek kodun konsol çıktısı referans için görüntülenmiştir.

IsProtected - Before Protecting VBA Project: False

IsProtected - After Protecting VBA Project: True