I am trying to unshare and unprotect the workbook using one button.
I'm confused to which loop statement I shoud be using..any ideas?
see my code below
Private Sub CommandButton1_Click()
If ActiveWorkbook.MultiUserEditing Then
Application.DisplayAlerts = False
ActiveWorkbook.ExclusiveAccess
Application.DisplayAlerts = True
If Not ActiveWorkbook.MultiUserEditing Then
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs ActiveWorkbook.Name, accessmode:=xlShared
Application.DisplayAlerts = True
??
ActiveSheet.Unprotect Password:="123", UserInterfaceOnly:=True
End If
End sub
Bookmarks