Trying to run protect macro in compiled vba. SOLVED

I need to use the protect as a macro as opposed to locking as I need the macros to process “protected data”

The original code is (not the real password)
Worksheets(“Imported Data”).Protect (964257816), _
Userinterfaceonly:=True, _
AllowFiltering:=True

When I run the compiler I am thrown lots of errors.

I have tried
Application.Worksheets(“Imported Data”).Protect (964257816), Userinterfaceonly:=True, AllowFiltering:=True

But still errors associated with the options, Userinterfaceonly:=True, AllowFiltering:=True.

Any workaround?

Anton

Ok I have solved the error by changing the code to
Application.Worksheets(“Imported data”).Protect(964257816,False,False,False,True,False,False,False,False,False,False,False,False,False,False,False)

Yes, you are right, our VBA compiler requires that all parameters be specified, even if you don’t use them.