bonjour tout le monde
j'ai une macro qui s’exécute sans problème sur mon excel 2007 de mon pc portable ; mais quand j’exécute la même sur mon fixe sous excel 2007 biensur.

j'ai la fonction alert display qui ne fonctionne pas au niveau de la fermeture de fichier wbk.close et donc excel me demande si je veux enregistrer !!!.

merci de bien m'éclaircir le problème car j'ai le même soucis avec une autre macro que je désire lancer sous excel 2003 dont la fonction Application.DisplayAlerts = False ne fonctionne pas.




Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Sub Test()
Dim Msg As String, Title As String
Dim Wbk As Workbook
Dim Prs As Double
Dim L As Long
Dim Fichier
 
Application.DisplayAlerts = False
Fichier = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
 
If Fichier <> False Then
    Set Wbk = Workbooks.Open(Fichier)
 
    Msg = "Veuillez saisir votre longueur"
    Title = "-------PRS--------"
    L = Val(InputBox(Msg, Title, Default))
 
    With Wbk.Worksheets(1)
        If L <= 1000 * .Cells(23, 41).Value Then
            .Cells(23, 41).Value = L / 1000
            Prs = .Cells(25, 41).Value
        ElseIf L <= 1000 * .Cells(23, 42).Value Then
            .Cells(23, 42).Value = L / 1000
            Prs = .Cells(25, 42).Value
        ElseIf L >= 1000 * .Cells(23, 43).Value Then
            .Cells(23, 43).Value = L / 1000
            Prs = .Cells(25, 43).Value
        End If
    End With 
    Wbk.Close True
    Set Wbk = Nothing
    cible = c
    On Error Resume Next
    x = Apllication.Match(Cible,ThisWorkbook.Worksheets("PRS data").colomns("A:A"),0)
if x= 0 Then 
  MsgBox "Valeur" & Cible & "non trouvée."
 Else
ThisWorkbook.Worsheets("PRS data").Cells(x,6).value = PRS
            MsgBox "Valeur " & Cible & " trouvée dans la ligne:" & x
     End If
 
     End If
End If
End Sub