Ram Malladi
04-22-2019, 01:59 PM
Hello to the group members!
Can someone help me with VBA code for determining if an excel file has 'specific excel-based add-ins' (i have a list of specific add-ins) loaded and password protected? Any help is appreciated.
Note: I have the below code to determine if macros stored under VBAProject are locked or not. But this code is not able to determine if there are add-ins that are locked (as these add-ins are not stored under VBAProject but just outside of VBAProject).
--------------
Sub wsht_macro_protect(Ana_Name, sht_Count, pro_Prot, sht_Prot_cnt, sht_Prot)
Dim sh As Worksheet
Dim wb As Workbook
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
Set wb = Workbooks(Ana_Name) 'Input workbook name here or use do ...loop
'Initialization
sht_Count = 0
sht_Prot_cnt = 0
sht_Prot = ""
pro_Prot = ""
wb.Activate
sht_Count = Sheets.Count
If wb.VBProject.Protection = vbext_pp_locked = True Then
pro_Prot = "Protected"
End If
For Each sh In wb.Worksheets
If sh.ProtectContents = True Then
sht_Prot_cnt = sht_Prot_cnt + 1
sht_Prot = "Protected"
End If
Next sh
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.AskToUpdateLinks = True
End Sub
------------------
Any help is appreciated.
Thank you
Ram.
Can someone help me with VBA code for determining if an excel file has 'specific excel-based add-ins' (i have a list of specific add-ins) loaded and password protected? Any help is appreciated.
Note: I have the below code to determine if macros stored under VBAProject are locked or not. But this code is not able to determine if there are add-ins that are locked (as these add-ins are not stored under VBAProject but just outside of VBAProject).
--------------
Sub wsht_macro_protect(Ana_Name, sht_Count, pro_Prot, sht_Prot_cnt, sht_Prot)
Dim sh As Worksheet
Dim wb As Workbook
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
Set wb = Workbooks(Ana_Name) 'Input workbook name here or use do ...loop
'Initialization
sht_Count = 0
sht_Prot_cnt = 0
sht_Prot = ""
pro_Prot = ""
wb.Activate
sht_Count = Sheets.Count
If wb.VBProject.Protection = vbext_pp_locked = True Then
pro_Prot = "Protected"
End If
For Each sh In wb.Worksheets
If sh.ProtectContents = True Then
sht_Prot_cnt = sht_Prot_cnt + 1
sht_Prot = "Protected"
End If
Next sh
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.AskToUpdateLinks = True
End Sub
------------------
Any help is appreciated.
Thank you
Ram.