Excel VisualBasic Script

Sub ProtectAndShare()
    Dim wb As Workbook
    Set wb = ThisWorkbook
    wb.ProtectSharing "\\public\shared.xls", "pass1", "pass2", , , "pass3"
End Sub