Lancer une macro PPT à partir d'Excel

kombakom Messages postés 8 Date d'inscription jeudi 7 avril 2005 Statut Membre Dernière intervention 5 octobre 2005 - 5 oct. 2005 à 19:35
Tuning Max Messages postés 314 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 31 août 2006 - 6 oct. 2005 à 14:59
Bonjour,






Je voudrai lancer une macro attaché à un document Power Point à partir d'un fichier Excel.


Si je lance la macro de Power Point elle fonctionne, mais pas d’Excel, SAUF si je l’ai lancé au moins une fois de Power Point et que je n’ai pas fermé Power Point.






Le message d’erreur est le suivant :


“Application (unknown member) : Invalid request. Sub or function not defined.”







CODE :


D'excel :






Sub AutomatePowerPoint()





Dim oPPTApp As PowerPoint.Application


Dim oPPTPres As PowerPoint.Presentation


Dim sPresentationFile As String


sPresentationFile = "G:\BOITE\THT\Essai 1.PPT"





Set oPPTApp = New PowerPoint.Application


oPPTApp.Visible = True


Set oPPTPres = oPPTApp.Presentations.Open(sPresentationFile)


With oPPTPres = oPPTApp.Run("WechPPT")





Lancement = oPPTApp.Run(“WechPPT”)





End With


Set oPPTPres = Nothing


Set oPPTApp = Nothing


End Sub














Dans PowerPoint :






Public Sub WechPPT()


.....

1 réponse

Tuning Max Messages postés 314 Date d'inscription mercredi 15 juin 2005 Statut Membre Dernière intervention 31 août 2006 1
6 oct. 2005 à 14:59
Pour moi j'ai en modifiant légèrement ton code ça fonctionne sans problème.
J'espère avoir pu ainsi t'aider

Sub AutomatePowerPoint()
Dim PPTApp As Object
Dim oPPTApp As PowerPoint.Application


Set oPPTApp = New PowerPoint.Application


With oPPTApp
.Visible = True
.Presentations.Open ("c:\temp\Essai1.PPT")
.Run ("Essai1.ppt!Module1.Macro1")
End With


End Sub
0
Rejoignez-nous