I am working on a report which consists of ActiveX plugins and the data is supposed to filter based on change in the selection. All works well, but I am getting the "RUNTIME ERROR 91" every time I open the file with different filename.
I need to share these password-protected files to more than 10 clients at once and don't want them to get these errors.
My code:
Sub advancedfilter_protect()
'Disable Screen Updating
Application.ScreenUpdating = False
Dim actvsht As Worksheet
Set actvsht = ActiveWorkbook.ActiveSheet
For Each actvsht In ActiveWorkbook.Worksheets
actvsht.Activate
actvsht.Unprotect "Password"
Next
Call advancedfilter_data
For Each actvsht In ActiveWorkbook.Worksheets
actvsht.Protect "Password", UserInterfaceOnly:=True
Next
End Sub