Fonction VBA OK pas à pas, KO automatique?
Bonjour,
Je ne comprends pas
Je donne les exemples
Code:
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
| Sub Visu01(ByRef valcel As String)
On Error GoTo Erreur
Dim objSld As Slide
Dim oPPTapp As PowerPoint.Application
Dim MaPresentation As PowerPoint.Presentation
Set oPPTapp = CreateObject("PowerPoint.Application")
oPPTapp.Visible = True
Set MaPresentation = oPPTapp.Presentations.Open(FileName:="C:\Users\SERGE\Desktop\VBA\PwpVBA.pptm")
'Sélectionne la diapo paramètrée
MaPresentation.Slides(valcel).Select
Affichage valcel
MaPresentation.Close
oPPTapp.Quit
Set MaPresentation = Nothing
Set oPPTapp = Nothing
Erreur:
' Diapo non trouvée
'MaPresentation.Slides("PRESENTATION").Select
'msg1 = valcel
'msg2 = "Diapo non trouvée"
'MsgBox msg1 & " " & msg2
' MaPresentation.Close
' oPPTapp.Quit
' Set MaPresentation = Nothing
' Set oPPTapp = Nothing
End Sub |
Code:
1 2 3 4 5
| Sub Affichage(ByRef valcel As String)
MsgBox "POWER POINT Valcel value = " & valcel
End Sub |
Code:
1 2 3 4
| Sub Essais()
Visu01 "JAUNE"
End Sub |
___________________________________________
MACRO Essais
exécution pas à pas
OK affichage diapo "JAUNE"
exécution normale
KO affichage de la 1ère diapo
Merci de m'éclairer