Bonjour le forum
j'ai essayé ce code pour empêcher, par macro, la seconde ouverture d'un classeur
ça fonctionne bien à la première ouverture mais pas à la seconde
merci de vos lumières
Kinel
j'appelle la macro IsWorkBookOpen dans le Private Sub Workbook_Open()
Sub IsWorkBookOpen()
Dim wBook As Workbook
On Error Resume Next
Set wBook = Workbooks("C:\FLK\mon classeur.xls")
If wBook Is Nothing Then 'Not open
Application.DisplayAlerts = False
MsgBox "Workbook is not open"
Set wBook = Nothing
Sheets("Feuil1").Select
On Error GoTo 0
Else 'It is open
Application.DisplayAlerts = False
MsgBox "Yes it is open"
Set wBook = Nothing
On Error GoTo 0
End If
End Sub
j'ai essayé ce code pour empêcher, par macro, la seconde ouverture d'un classeur
ça fonctionne bien à la première ouverture mais pas à la seconde
merci de vos lumières
Kinel
j'appelle la macro IsWorkBookOpen dans le Private Sub Workbook_Open()
Sub IsWorkBookOpen()
Dim wBook As Workbook
On Error Resume Next
Set wBook = Workbooks("C:\FLK\mon classeur.xls")
If wBook Is Nothing Then 'Not open
Application.DisplayAlerts = False
MsgBox "Workbook is not open"
Set wBook = Nothing
Sheets("Feuil1").Select
On Error GoTo 0
Else 'It is open
Application.DisplayAlerts = False
MsgBox "Yes it is open"
Set wBook = Nothing
On Error GoTo 0
End If
End Sub