I have a drop-down menu assigned to a shape, i use it to open others workbooks, but these are shared workbooks, so i want VBA to tell me when the workbook i selected are being used by another user and dont open it, because I need it to be opened in edit mode.
My code so far:
Sub MenuSuspenso()
Application.CommandBars("Cell").Reset
Dim cbc As CommandBarControl
For Each cbc In Application.CommandBars("cell").Controls
cbc.Visible = False
Next cbc
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.Caption = "AQUAS"
.OnAction = "AQUAS"
End With
End Sub
Sub AQUAS()
Dim book As Workbook
Set book = "\\T\Public\DOCS\Hualley\FLUXO CAIXA HINDY - 111.xlsm"
If book.ReadOnly = True Then
MsgBox ("Arquivo em Uso")
book.Close()
app.Quit()
Else
Workbooks.Open ("\\T\Public\DOCS\Hualley\FLUXO CAIXA HINDY - 111.xlsm"), True
End Sub
The book comes from a server drive, and have links ( true for UpdateLinks ) and macros.
