SkywardPalm
Board Regular
- Joined
- Oct 23, 2021
- Messages
- 61
- Office Version
- 365
- Platform
- Windows
I have tried multiple ways of protecting vba code using vba, but I continue to get runtime errors such as "Run-time error '438': Object doesnt support this property or method." I've looked around but haven't found a solution that works for me.
VBA Code:
Sub ProtectVBACode()
Dim password As String
password = "pass"
Dim vbProj As Object
Set vbProj = ThisWorkbook.VBProject
vbProj.Protect password
MsgBox "VBA code is locked for viewing with password."
End Sub